Closed Nalini1998 closed 1 year ago
What will happen after running the following code?
const countries = ['Japan', 'Denmark', 'Mexico', 'Morocco']; countries.shift(); console.log(countries); countries = ['England', 'Mozambique', 'Cambodia', 'Peru']; console.log(countries);
A. One array will be logged to the console followed by an error message
['Japan', 'Denmark', 'Mexico']; TypeError: Assignment to constant variable
B. One array will be logged to the console followed by an error message
# ['Denmark', 'Mexico', 'Morocco']; TypeError: Assignment to constant variable
C. Two arrays will be logged to the console:
['Denmark', 'Mexico', 'Morocco']; ['England', 'Mozambique', 'Cambodia', 'Peru'];
D. Two arrays will be logged to the console:
['Japan', 'Denmark', 'Mexico']; ['England', 'Mozambique', 'Cambodia', 'Peru'];
I chose B. One array will be logged to the console followed by an error message
['Denmark', 'Mexico', 'Morocco']; TypeError: Assignment to constant variable
What will happen after running the following code?
A. One array will be logged to the console followed by an error message
B. One array will be logged to the console followed by an error message
C. Two arrays will be logged to the console:
D. Two arrays will be logged to the console: