Home > Web Front-end > Front-end Q&A > Does null represent 0 in javascript?

Does null represent 0 in javascript?

WBOY
Release: 2022-04-13 18:06:00
Original
2727 people have browsed it

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".

Does null represent 0 in javascript?

The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.

Does null represent 0 in JavaScript?

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

Does null represent 0 in javascript?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template