Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In both cases, the change to the array was maintained outside of the function
- const concept = ['arrays', 'can', 'be', 'mutated'];
- function changeArr(arr){
- arr[3] = 'MUTATED';
- }
- changeArr(concept);
- console.log(concept); //Output will be [ 'arrays', 'can', 'be', 'MUTATED' ]
- function removeElement(newArr){
- newArr.pop();
- }
- removeElement(concept);
- console.log(concept); //Output will be [ 'arrays', 'can', 'be' ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement