-
-
Save AbdelrhmanAmin/9757277a7934f87120873c2163969463 to your computer and use it in GitHub Desktop.
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
// Pop quiz! What gets logged? | |
var o = { | |
[console.log('before')]: 4, | |
foo: (function () { | |
console.log('nope :('); | |
throw 'nope' | |
})(), | |
[console.log('after')]: 4 | |
}; | |
//--------------\\ | |
(function (){}).name; // '' | |
var Foo = function () {}; | |
var f = new Foo(); | |
f.constructor.name; // '' or 'Foo'? | |
// | |
var Bar = Foo; | |
var b = new Bar(); | |
b.constructor.name; // '' or 'Foo' or 'Bar'? | |
// | |
(function (Foo) { | |
return (new Foo).constructor.name; | |
})( function() {} ); | |
// | |
// and how about: | |
var o = { | |
Foo: function () {} | |
}; | |
(new o.Foo).constructor.name; | |
//--------------\\ | |
// Pop quiz: What'll this do? | |
var cull = Object.create(null); | |
var obj = {}; | |
obj[cull] = 4; | |
//--------------\\ | |
// Pop quiz: What does this do? | |
class Foo { | |
constructor() { | |
console.log('foo'); | |
} | |
} | |
class Bar extends Foo { | |
constructor() { | |
super(); | |
super(); | |
} | |
} | |
new Bar(); | |
//--------------\\ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment