Home > Article > Web Front-end > Does null represent 0 in javascript?
null in JavaScript does not represent 0. Only in basic mathematical operations, the null value will be converted to 0; null in JavaScript represents "nothing", and null is a special type with only one value. , and 0 is a numeric type, which represents the value "0".
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
In JavaScript, null represents "nothing".
null is a special type with only one value. Represents an empty object reference.
The null value indicates a reference to an object or address that does not exist or is invalid. Even if it points to something that doesn't exist, it doesn't matter, it's a global object (also one of JavaScript's primitive values).
Negating a null value returns true, but comparing it to false (or true) gives false.
In basic mathematical operations, the null value will be converted to 0
0 is a number, which represents the value 0.
Number:
There are two forms of representation of this type, the first is an integer, and the second is a floating point number. Integer: can be represented by decimal, octal, and hexadecimal literal values. Floating point number: The value must contain a decimal point and there must be one digit after the decimal point.
【Related recommendations: javascript video tutorial, web front-end】
The above is the detailed content of Does null represent 0 in javascript?. For more information, please follow other related articles on the PHP Chinese website!