The following points summarize what you should learn from reading this book (and studying the code examples). Read each summary and return to the topic in the book if you don't understand what it says.
new
keyword or using a shorthand literal expression. Function()
objects), so in JavaScript, objects create objects. Object()
, Array()
, String()
, Number()
, Boolean()
, Function()
, Date()
, RegExp()
and Error()
. The String()
, Number()
and Boolean()
constructors serve a dual purpose: providing a) a primitive value and b) an object wrapper when needed, so that primitive values can work like objects. null
, undefined
, "string"
, 10
, true
and false
They are all primitive values and have no object properties unless they are treated like objects. Array()
, String()
, Number()
, Boolean( )
, Function()
, Date ()
, RegExp()
and Error()
constructors use The new
keyword is called to create an object called a "complex object" or "reference object". 李>
"string"
, 10
, true
, and false
have no object properties in their raw forms until they are used as objects; JavaScript then creates temporary wrapper objects behind the scenes so that the values can behave like objects. Array['prototype']['join'].apply()
). prototype
attribute. If it's not found there, because the prototype holds an object value and that value is created from the Object()
constructor, so in the Object()
constructor Find this property on the prototype
property (Object).prototype
). If the property is not found there, the property is determined to be undefined
. prototype
Lookup chains are how inheritance (aka prototypal inheritance) is designed in JavaScript. Object()
because the prototype
property itself is an Object()
Object. this
keyword, when used inside a function, is a general way to reference the object containing the function. this
is determined at runtime based on the context in which the function is called. var
Function expressions and variables declared inside the function will become global properties. However, function statements within function scope are still defined in the scope in which they are written. var
) will become properties of the global object. var
) become global variables. Thank you for reading!
The above is the detailed content of Evaluation. For more information, please follow other related articles on the PHP Chinese website!