You will make use of
indexOf method on arrays to find the output of the code
let cities = ["Vancouver", "Boston", "New York", "Victoria", "San Francisco"]let updatedCities = cities.map(city => city + 2)console.log(updatedCities.indexOf("Victoria"))
00:00 So we have bunch of cities in the cities array and we are performing some computation on this array. And finally we want to know what happens when we find indexOf Victoria city. Let's work together to find the right answer. In the first line, we create an array with five cities. In the second line, we're using map method on arrays. This means that the result of this expression will produce a new array. But what will this area contain? That is defined by the implementation inside the map method. For each city that is available in cities, we are adding number two, so the value of updatedCities will be a new array that contains all the cities from the cities array, but number two added to the each city. Now in the final console.log we are trying to find the string Victoria in the updatedCities array. And as you can see, Victoria does not exist in the array.