JS Interview 3
jS Interview 3
by stanvishne
JavaScript
var a = 7;
var b = a;
a += 3;
console.log(b);
/*
var a = [1, 2, 3];
var b = a;
a[1] = 10;
console.log(b[1]);
var a = "Hello,";
var b = a;
a += "World!"
console.log(b);
var obj = {
mother: "Alice",
father: "Bob",
daughter: "Carol"
};
for(var a in obj) {
console.log(a);
}
var m = ["Alice", "Bob", "Carol"];
for (var a in m) {
console.log(a);
}
var foo = 7;
function bar() {
console.log(foo);
var foo = 100;
}
bar();
if (!("baz" in window)) {
var baz = 7;
}
console.log(baz);
//-- 9 ----------------------------------------------
function test() {
console.log(getMessage());
return;
function getMessage() {
return "Hi there!";
}
}
test();
const arr=[1,2,3,4];
for (var i=0; i<arr.length; i++) {
setTimeout(function() {
console.log(arr[i])
},0)
}
*/