Home > Web Front-end > JS Tutorial > body text

Does javascript distinguish between integers and floating point numbers?

醉折花枝作酒筹
Release: 2023-01-07 11:43:42
Original
2714 people have browsed it

JavaScript does not distinguish between integer values ​​and floating point values. Number types can be stored. If you pass a string to the Number() conversion function, it attempts to convert it to an integer or floating point number.

Does javascript distinguish between integers and floating point numbers?

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

JavaScript does not distinguish between integer values ​​and floating point values. Number types can be stored.

If you pass a string to the Number() conversion function, it attempts to convert it into an integer or floating point number.

JavaScript Numeric

JavaScript has only one numeric type.

You can use or not use decimal points when writing values:

Example:





JavaScript 数值

写数值时用不用小数点均可:

Copy after login

Result:

Does javascript distinguish between integers and floating point numbers?

##[Recommended learning :

javascript advanced tutorial

The above is the detailed content of Does javascript distinguish between integers and floating point numbers?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!