Last active
May 16, 2018 04:51
-
-
Save completejavascript/d90fca361237620b5f085351b2ab1151 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
let a = { | |
x: 1, | |
getX: function() { | |
return this.x; | |
} | |
}; | |
let b = Object.create(a); | |
b.x = 10; | |
delete b.x; | |
console.log(b.getX()); | |
// 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 = [1, 'a', {x : 1}, {y : 2}, [1, 2], {x : 1}]; | |
console.log(a.indexOf({x : 1})); | |
// 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
(function() { | |
var x = y = 10; | |
})(); | |
console.log(y); | |
// 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 = [1, 2, 3]; | |
a[-1] = 4; | |
a[10] = 5; | |
console.log(a[6], a.length); | |
// 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 = {}, | |
b = {x: 12}, | |
c = [1, 2], | |
d = {m: 'a', n: 'b'}; | |
a[b] = 34; | |
a[c] = 56; | |
a[d] = 78; | |
console.log(a[b], a[c], a[d]); | |
// 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
var x = (x = 0, x++, x); | |
let y = (y = 0, y++, y); | |
console.log(x, y); | |
// What will console print ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment