August 2016
Beginner to intermediate
847 pages
17h 28m
English
function F() {
function C() {
return this;
}
return C();
}
var o = new F();Does the value of this refer to the global object or the object o?
function C(){
this.a = 1;
return false;
}
console.log(typeof new C());> c = [1, 2, [1, 2]];
> c.sort();
> c.join('--');
> console.log(c); String() constructor didn't exist. Create a constructor function, MyString(), that acts like String() as closely as possible. You're not allowed to use any built-in string methods or properties, and remember that String() doesn't exist. You can use this code to test your constructor:> var s = new MyString('hello'); > s.length; ...