Last active
May 28, 2018 03:50
-
-
Save completejavascript/f68d5dbcede5654c399611c29d61523a to your computer and use it in GitHub Desktop.
Fun quiz!!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.objCustom = function() {}; | |
Array.prototype.arrCustom = function() {}; | |
let a = [3, 5, 7]; | |
a.x = 'hello'; | |
Object.defineProperty(a, 'y', {}); | |
Object.defineProperty(a, 'z', { | |
enumerable: true | |
}); | |
for (let i of a) { | |
console.log(i); | |
} | |
// What will console print? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.objCustom = function() {}; | |
Array.prototype.arrCustom = function() {}; | |
let a = [3, 5, 7]; | |
a.x = 'hello'; | |
Object.defineProperty(a, 'y', {}); | |
Object.defineProperty(a, 'z', { | |
enumerable: true | |
}); | |
for (let i in a) { | |
console.log(i); | |
} | |
// What will console print? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.objCustom = function() {}; | |
Array.prototype.arrCustom = function() {}; | |
let a = [3, 5, 7]; | |
a.x = 'hello'; | |
Object.defineProperty(a, 'y', {}); | |
Object.defineProperty(a, 'z', { | |
enumerable: true | |
}); | |
for (let i in a) { | |
if (a.hasOwnProperty(i)) console.log(i); | |
} | |
// What will console print? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj = { | |
x: 1, | |
y: "hello", | |
z: {a : 1}, | |
t: [1, 2] | |
}; | |
Object.freeze(obj); | |
obj.x = 2; | |
obj.y = "bye"; | |
obj.z.a = 2; | |
obj.t[0] = 3; | |
obj.t[1] = 4; | |
console.log(obj); | |
// What will console print? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj = { | |
x : 1, | |
y : "Hi", | |
z : function() { | |
console.log(this.x, this.y); | |
} | |
}; | |
let str = JSON.stringify(obj); | |
console.log(str); | |
// What will console print? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = {y: 1}; | |
a.x = a; | |
let str = JSON.stringify(a); | |
console.log(str); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment