Created
July 31, 2020 16:07
-
-
Save katepapineni/19f85989c2f084ac7e787e13c2e230f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cities = ['Sydney', 'Rome', 'Tokyo', 'Delhi', 'Zurich', ]; | |
const getCity = (city) => { | |
return cities.splice(city, 2); | |
} | |
const city1 = getCity(cities.indexOf('Seattle')); | |
cities.length = 5; | |
const city2 = cities[cities.length - 1]; | |
// What's the output? | |
console.log(`City 1 is: ${city1}`); | |
console.log(`City 2 is: ${city2}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment