Skip to content

Instantly share code, notes, and snippets.

@completejavascript
Last active May 16, 2018 04:51
Show Gist options
  • Save completejavascript/d90fca361237620b5f085351b2ab1151 to your computer and use it in GitHub Desktop.
Save completejavascript/d90fca361237620b5f085351b2ab1151 to your computer and use it in GitHub Desktop.
Fun quiz!!!
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 ?
let a = [1, 'a', {x : 1}, {y : 2}, [1, 2], {x : 1}];
console.log(a.indexOf({x : 1}));
// What will console print ?
(function() {
var x = y = 10;
})();
console.log(y);
// What will console print ?
let a = [1, 2, 3];
a[-1] = 4;
a[10] = 5;
console.log(a[6], a.length);
// What will console print ?
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 ?
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