Skip to content

Instantly share code, notes, and snippets.

@sandrabosk
Created July 10, 2020 15:14
Show Gist options
  • Save sandrabosk/ba2ebf12910b3b42bd2d96591005b492 to your computer and use it in GitHub Desktop.
Save sandrabosk/ba2ebf12910b3b42bd2d96591005b492 to your computer and use it in GitHub Desktop.
// Use the given array and perform following operations on it:
const favorites = ['javascript', 'html', 'css'];
// remove first element
// ... your code here
console.log(favorites); // => [ 'html', 'css' ]
// remove last element
// ... your code here
console.log(favorites); // => [ 'html' ]
// add 'react' on the first place
// ... your code here
console.log(favorites); // => [ 'react', 'html' ]
// add 'node' to the last place
// ... your code here
console.log(favorites); // => [ 'react', 'html', 'node' ]
// remove element in the position 2 and add 'express'
// ... your code here
console.log(favorites); // => [ 'react', 'express', 'node' ]
// remove elements in the positions 2 and 3 and add 'mongodb'
// ... your code here
console.log(favorites); // => [ 'react', 'mongodb' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment