Evaluation
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.
- Objects consist of named properties that store values.
- Most things in JavaScript behave like objects. Complex values are objects, while primitive values can be treated like objects. This is why you might hear people say that everything in JavaScript is an object.
- Create an object by calling a constructor using the
new
keyword or using a shorthand literal expression. - Constructors are objects (
Function()
objects), so in JavaScript, objects create objects. - JavaScript provides nine native constructors:
Object()
,Array()
,String()
,Number()
,Boolean()
,Function()
,Date()
,RegExp()
andError()
. TheString()
,Number()
andBoolean()
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. - Values
null
,undefined
,"string"
,10
,true
andfalse
They are all primitive values and have no object properties unless they are treated like objects. - When>Object(),
Array()
,String()
,Number()
,Boolean( )
,Function()
,Date ()
,RegExp()
andError()
constructors useThe new
keyword is called to create an object called a "complex object" or "reference object". 李> -
"string"
,10
,true
, andfalse
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. - The original value is stored by value and copied literally when copied. Complex object values, on the other hand, are stored by reference, and when copied, are copied by reference.
- Primitive values are equal to other primitive values when their values are equal, whereas complex objects are equal only when they refer to the same value. That is: when one complex value refers to the same object, two complex values are equal to the other complex value.
- Due to the nature of complex objects and references, JavaScript objects have dynamic properties.
- JavaScript is mutable, which means that native objects and user-defined object properties can be manipulated at any time.
- Getting/setting/updating object properties is done by using dot notation or square bracket notation. Bracket notation is convenient when the object property name you are operating on takes the form of an expression (for example,
Array['prototype']['join'].apply()
). - When referencing an object property, a lookup chain will be used to first look at the object referenced by the property. If the attribute does not exist, the attribute is looked up in the constructor
prototype
attribute. If it's not found there, because the prototype holds an object value and that value is created from theObject()
constructor, so in theObject()
constructorFind this property on the prototype
property (Object).prototype
). If the property is not found there, the property is determined to beundefined
. -
prototype
Lookup chains are how inheritance (aka prototypal inheritance) is designed in JavaScript. - Due to the object property lookup chain (aka prototypal inheritance), all objects inherit from
Object()
because theprototype
property itself is anObject()
Object. - JavaScript functions are first-class citizens: functions are objects with properties and values. The
-
this
keyword, when used inside a function, is a general way to reference the object containing the function.
The value of -
this
is determined at runtime based on the context in which the function is called. - When used in the global scope, the this keyword refers to the global object.
- JavaScript uses functions to create unique scopes.
- JavaScript provides a global scope, and all JavaScript code exists in this scope.
- Functions (especially wrapper functions) create scope chains for parsing variable lookups.
- The scope chain is set based on the way the code is written, not necessarily based on the context in which the function is called. This allows a function to access the scope in which it was originally written, even if the function is called from a different context. This result is called a closure.
- Do not use
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. - Functions and variables declared in the global scope (without
var
) will become properties of the global object. - Functions and variables declared in the global scope (using
var
) become global variables.
in conclusion
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



What do you think of furmark? 1. Set the "Run Mode" and "Display Mode" in the main interface, and also adjust the "Test Mode" and click the "Start" button. 2. After waiting for a while, you will see the test results, including various parameters of the graphics card. How is furmark qualified? 1. Use a furmark baking machine and check the results for about half an hour. It basically hovers around 85 degrees, with a peak value of 87 degrees and room temperature of 19 degrees. Large chassis, 5 chassis fan ports, two on the front, two on the top, and one on the rear, but only one fan is installed. All accessories are not overclocked. 2. Under normal circumstances, the normal temperature of the graphics card should be between "30-85℃". 3. Even in summer when the ambient temperature is too high, the normal temperature is "50-85℃

The "Inaction Test" of the new fantasy fairy MMORPG "Zhu Xian 2" will be launched on April 23. What kind of new fairy adventure story will happen in Zhu Xian Continent thousands of years after the original work? The Six Realm Immortal World, a full-time immortal academy, a free immortal life, and all kinds of fun in the immortal world are waiting for the immortal friends to explore in person! The "Wuwei Test" pre-download is now open. Fairy friends can go to the official website to download. You cannot log in to the game server before the server is launched. The activation code can be used after the pre-download and installation is completed. "Zhu Xian 2" "Inaction Test" opening hours: April 23 10:00 - May 6 23:59 The new fairy adventure chapter of the orthodox sequel to Zhu Xian "Zhu Xian 2" is based on the "Zhu Xian" novel as a blueprint. Based on the world view of the original work, the game background is set

"Operation Delta" will launch a large-scale PC test called "Codename: ZERO" today (March 7). Last weekend, this game held an offline flash mob experience event in Shanghai, and 17173 was also fortunate to be invited to participate. This test is only more than four months away from the last time, which makes us curious, what new highlights and surprises will "Operation Delta" bring in such a short period of time? More than four months ago, I experienced "Operation Delta" in an offline tasting session and the first beta version. At that time, the game only opened the "Dangerous Action" mode. However, Operation Delta was already impressive for its time. In the context of major manufacturers flocking to the mobile game market, such an FPS that is comparable to international standards

Title: Analysis of the reasons and solutions for why the secondary directory of DreamWeaver CMS cannot be opened. Dreamweaver CMS (DedeCMS) is a powerful open source content management system that is widely used in the construction of various websites. However, sometimes during the process of building a website, you may encounter a situation where the secondary directory cannot be opened, which brings trouble to the normal operation of the website. In this article, we will analyze the possible reasons why the secondary directory cannot be opened and provide specific code examples to solve this problem. 1. Possible cause analysis: Pseudo-static rule configuration problem: during use

Maven is an open source project management tool that is commonly used for tasks such as construction, dependency management, and document release of Java projects. When using Maven for project build, sometimes we want to ignore the testing phase when executing commands such as mvnpackage, which will improve the build speed in some cases, especially when a prototype or test environment needs to be built quickly. This article will detail how to ignore the testing phase in Maven, with specific code examples. Why you should ignore testing During project development, it is often

Introduction Continuous integration (CI) and continuous deployment (CD) are key practices in modern software development that help teams deliver high-quality software faster and more reliably. Jenkins is a popular open source CI/CD tool that automates the build, test and deployment process. This article explains how to set up a CI/CD pipeline with Jenkins using PHP. Set up Jenkins Install Jenkins: Download and install Jenkins from the official Jenkins website. Create project: Create a new project from the Jenkins dashboard and name it to match your php project. Configure source control: Configure your PHP project's git repository as Jenkin

Functional testing verifies function functionality through black-box and white-box testing, while code coverage measures the portion of code covered by test cases. Different languages (such as Python and Java) have different testing frameworks, coverage tools and features. Practical cases show how to use Python's Unittest and Coverage and Java's JUnit and JaCoCo for function testing and coverage evaluation.

Go language function closures play a vital role in unit testing: Capturing values: Closures can access variables in the outer scope, allowing test parameters to be captured and reused in nested functions. Simplify test code: By capturing values, closures simplify test code by eliminating the need to repeatedly set parameters for each loop. Improve readability: Use closures to organize test logic, making test code clearer and easier to read.
