Home >Web Front-end >JS Tutorial >What are the several types of data types in js?
JavaScript data types are divided into the following categories: Basic types: Number, String, Boolean, Null, Undefined Object types: Object, Array, Function, Date, RegExp Special types: Symbol, BigInt You can use the typeof operator Determine the data type.
Data types in JS
The data types in JavaScript are mainly divided into the following categories:
1. Basic types
true
or false
. 2. Object type
3. Special types
How to determine the data type
You can use the typeof
operator to determine the data type of a variable. For example:
<code class="javascript">typeof 42; // "number" typeof "Hello"; // "string" typeof true; // "boolean" typeof null; // "object" typeof undefined; // "undefined"</code>
The above is the detailed content of What are the several types of data types in js?. For more information, please follow other related articles on the PHP Chinese website!