Home  >  Article  >  Web Front-end  >  What are the numerical types in javascript

What are the numerical types in javascript

王林
王林Original
2021-07-09 14:10:562197browse

The numerical types in JavaScript include string, number, Boolean, null, undefined, Symbol, object, array and function. Objects, arrays and functions are reference data types.

What are the numerical types in javascript

#The operating environment of this article: windows10 system, javascript 1.8.5, thinkpad t480 computer.

There are two types of numerical types in JavaScript: value types and reference data types.

Value type (basic type): String, Number, Boolean, Null, Undefined, Symbol.

Reference data types: Object, Array, Function.

JavaScript has dynamic typing. This means that the same variable can be used as different types.

Look at the example:

var x;               // x 为 undefined
var x = 5;           // 现在 x 为数字
var x = "John";      // 现在 x 为字符串

Related video tutorial sharing: javascript video tutorial

The above is the detailed content of What are the numerical types in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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