Home
Javascript Fundamentals
# Javascript basics
# Javascript arrays
# Javascript objects
# Javascript dates
# Javascript Sets
Javascript DOM
# DOM selector methods
# Events and user interactions
# DOM manipulation
# DOM fundamentals
# Recursive functions
Challenge Rush
Random Challenge
// Write a function that takes an array of objects and a string as arguments// Add a property with key 'continent' and value equal to the string to each of the objects// Return the new array of objects// Tipp: try not to mutate the original array function myFunction ( arr, str ) { return }
return
myFunction([{ city: 'Tokyo', country: 'Japan' }, { city: 'Bangkok', country: 'Thailand' }], 'Asia')
[{ city: 'Tokyo', country: 'Japan', continent: 'Asia' }, { city: 'Bangkok', country: 'Thailand', continent: 'Asia' }]
myFunction([{ city: 'Stockholm', country: 'Sweden' }, { city: 'Paris', country: 'France' }], 'Europe')
[{ city: 'Stockholm', country: 'Sweden', continent: 'Europe' }, { city: 'Paris', country: 'France', continent: 'Europe' }]