SoFunction
Updated on 2025-04-14

JavaScript Language Essence Learning Notes


Number: 64-bit floating point number
If a literal literal has an exponential part, then the knowledge of this literal is calculated from the part before e multiplied by 10 to the power of the part after e. So 100 and 1e2 are the same numbers.
The value NaN is a numerical value, which represents an operation result that cannot produce normal results. NaN is not equal to any value, including itself. You can use the function isNaN(number) to detect NaN.
The value Infinity represents all values ​​greater than 1.79769313486231570e+308.
JavaScript has an object Math, which contains a set of methods acting on numbers, and the (number) method converts a number into an integer.
Character Set:
Characters-16-bit (Unicode is a 16-bit character set)
JavaScript has no character type. To represent a character, just create a string containing only one character.
\u Convention allows specifying the character bits with numbers. "A" == "\u0041"
The string has a length attribute. For example, "seven".length is 5.
A string is immutable and can never be changed once a string is created. But it is easy to connect other strings through the + operator to get a new string. Two strings containing exactly the same characters and the same character order are considered to be the same string.
So: 'c' + 'a' + 't' === 'cat'

Simple types of JavaScript include numbers, strings, boolean values ​​(true and false), null values, and undefined values. All other values ​​are objects.
An object is a container for properties, and each other property has a name and value.
The name of the attribute can be any string including an empty string.
The attribute value can be any value other than the underfined value.
Objects in JavaScript are classless. It has no constraints on the name and value of the new attribute. Objects are suitable for collecting and managing data. Objects may include other objects, so they can be easily represented as a tree or graphical structure.
JavaScript includes a prototype chain feature that allows an object to inherit the properties of another object. Use it correctly can reduce the time and memory consumption of object initialization.
Object literal:
Object literals provide a very convenient way to create new object worth notation. An object literal is zero or multiple "name/value" pairs surrounded by a pair of curly braces. Object literals can appear where expressions are allowed to appear.
var empty_object = {};
var stooge = {
"first-name":"Jerome",
"last-name":"Howard"
};
The attribute name can make any string including the hole string. In object literals, if the attribute name is a legal JavaScript identifier and is not a reserved word, it is not mandatory to enclose the attribute name in quotes. Therefore, it is necessary to enclose "first-name" in quotes, but whether to enclose first_name is optional. Commas are used to separate multiple "name/value" pairs.
The value of the attribute can be obtained from any expression including another object literal. Objects can be nested.
Copy the codeThe code is as follows:

var flight = {
airline:"Oceanic",
number:815,
departure: {
IATA:"SYD",
time:"2004-09-22 14:55",
city:"Sydney"
},
arrival: {
IATA:"LAX",
time:"2004-09-23 10:42",
city:"Los Angeles"
}
};