js add element to array from other array by condition code example
Example: determine a value of an array element based on a condition in another array
cities
.filter(city => city.population < 3000000)
.sort((c1, c2) => c1.population - c2.population)
.map(city => console.log(city.name + ':' + city.population));