Look at this code:
function F() { function C() { return this; } return C(); } var o = new F();
The value of
this
refers to the global object or the objecto
?What's the result of executing this piece of code?
function C(){ this.a = 1; return false; } console.log(typeof new C());
What's the result of executing the following piece of code?
>>> c = [1, 2, [1, 2]]; >>> c.sort(); >>> c.join('--'); >>> console.log(c);
Imagine the
String()
constructor didn't exist. Create a constructor functionMyString()
that acts likeString()
as closely as possible. You're not allowed to use any built-in string methods or properties, and remember thatString()
doesn't exist. You can use this code to test your constructor:>>> var s = new MyString('hello'); >>> s.length;
5
>>> s[0];
"h"
>>> s.toString();
"hello"
>>> s.valueOf();
"hello"
>>> s.charAt(1);
"e"
>>>...

Object-Oriented JavaScript
By :

Object-Oriented JavaScript
By:
Overview of this book
Table of Contents (18 chapters)
Object-Oriented JavaScript
Credits
About the Author
About the Reviewers
Preface
Introduction
Primitive Data Types, Arrays, Loops, and Conditions
Functions
Inheritance
The Browser Environment
Coding and Design Patterns
Reserved Words
Built-in Functions
Built-in Objects
Regular Expressions
Index
Customer Reviews