Home > Web Front-end > Front-end Q&A > What does javascript's integer type mean?

What does javascript's integer type mean?

WBOY
Release: 2022-07-01 15:53:19
Original
2980 people have browsed it

In JavaScript, integer type refers to data without decimal part, which is a form of numeric data type; integer type can be represented by decimal, octal, and hexadecimal literal values, and Integer values ​​can be preceded by an optional sign (or -).

What does javascript's integer type mean?

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

What is the meaning of integer type in javascript

Integer type refers to data without decimal part.

Integers can be specified in decimal, hexadecimal or octal notation.

Includes integer constants and integer variables. Integer variables include short integers, basic integers, and long integers. They are divided into signed and unsigned versions. An intelligent computing method.

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.

Extended knowledge:

JavaScript data types

1. Undefined: The Undefined type has only one value, that is, the special value undefined . When a variable is declared using var but is not initialized, the variable value is undefined.

2. Null: The Null type is the second data type with only one value. Its special value is Null. From a logical point of view, null is an empty object pointer. And this is why using the typeof operator to detect null values ​​will return "object".

3. Boolean: The Boolean type has two values: true

false. It should be noted that the literal values ​​true and false of Boolean type are case-sensitive. In other words, True and False (and other mixed-size forms) are not Boolean values, just identifiers.

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

5. String: The String type is used to represent a character sequence consisting of zero or more 16-bit Unicode characters, that is, a string. As for whether to use single quotes or double quotes, there is still no difference in js. Remember to come in pairs.

6. Symbol type

Symbols (Symbols) are newly defined by ECMAScript version 6. The symbol type is unique and cannot be modified

var s = Symbol()
Copy after login

The new command cannot be used before the Symbol function, otherwise an error will be reported. This is because the generated Symbol is a primitive type value, not an object

The Symbol function can accept a string as a parameter, indicating a description of the Symbol instance

7. Object: Object data type , called an object, is a collection of data and functionality (functions). It can be created using the new operator followed by the name of the object type to be created. Can also be created using literal notation. Add a property with a different name (any string including the empty string).

8. Array

JavaScript arrays are written in square brackets. The items of the array are separated by commas.

The example is as follows:

<!DOCTYPE html>
<html>
<body>
<h2>JavaScript 字符串</h2>
<p>您可以在字符串内使用引号,只要这些引号与包围字符串的引号不匹配:</p>
<p id="demo"></p>
<script>
var answer1 = "It&#39;s alright";             // 双引号内的单引号
var answer2 = "He is called &#39;Bill&#39;";    // 双引号内的单引号
var answer3 = &#39;He is called "Bill"&#39;;    // 单引号内的双引号
document.getElementById("demo").innerHTML =
answer1 + "<br>" + 
answer2 + "<br>" + 
answer3;
</script>
</body>
</html>
Copy after login

Output result:

What does javascripts integer type mean?

[Related recommendations: javascript video tutorial, webfrontend

The above is the detailed content of What does javascript's integer type mean?. 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