December 24, 2019
πββοΈ μ€λ μκ²λ μ¬μ€
3λ² - After the following code runs, what will be the value of x.foo?
ππ» x.foo === 3
var x = { foo: 3 };
var y = x;
y = 2;
4λ² - After the following code runs, what will be the value of myArray? ππ» myArray === [2, 3, 4, 5]
var myArray = [2, 3, 4, 5];
var ourArray = myArray;
ourArray = [];
5λ² - After the following code runs, what will be the value of myArray?
ππ» myArray === [2, 3, 4, 5]
var myArray = [2, 3, 25, 5];
var ourArray = myArray;
ourArray[2] = 25;
ourArray = undefined;
7λ² - After the following code runs, what will be the value of myArray?
ππ» myArray === [2, 3, 4, 5]
var myArray = [2, 3, 4, 5];
function doStuff(arr) {
arr = [];
}
doStuff(myArray);
8λ² - After the following code runs, what will be the value of player.score?
ππ» player.score === 2
var player = { score: 3 };
function doStuff(obj) {
obj.score = 2;
obj = undefined;
}
doStuff(player);
9λ² - After the following code runs, what will be the value of player?
ππ» player === undefined
var player = { score: 3 };
function doStuff(obj) {
obj = {};
}
player = doStuff(player);