Tell us what’s happening:
Nothings happening so far. But I want to ask why should I go through all this when I can just delete the data I don’t want and instead add new data?
Plz explain.
Thank You.
Your code so far
// Setup
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
// Only change code below this line
myArray.unshift(["Paul" ,35])
console.log(myArray);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.
Hello @ameenarab5! You can always test your code by putting any data you like, but to pass the test, you need to have the code freeCodeCamp provides. If you want to play with your code, edit it and put in the data you want and then before clicking “Run Tests”, reset the code and do what’s said in the challenge, and then submit it.
The use cases of those functions are mostly for automated tasks. For example, you may want to have the data inside the array to be an user input. So, you would create a function so that when the user fills in the data and then hits the submit button, change or update the data of the array. So, I think those functions are used for those use cases. Maybe there’s more.