Get the App
SLTechnology News&Howtos  ›  Development  › 

Which of the js belong to the Number data type

Shulou Source: shulou.com Published: 2022-06-03 07:35:21 09月21日 Update

This article introduces the relevant knowledge of "which data types belong to Number in js". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Number types represent integers and floating point numbers. For number types, you can add, subtract, multiply and divide.

Let a = 10 let console.lg (a * 20); / / output 200 console.lg

2. In addition to regular numbers, special values such as Infinity,-Infinity and Nan also belong to the number type.

Typeof NaN;// output number

It is safe to do mathematical calculations in JavaScript. We can do anything: divide by 0 (a fatal error in other programming languages), treat non-numeric strings as numbers, and so on. JavaScript scripts never stop running because of a fatal error, and the worst-case scenario is the result of NaN.

This is the end of the content of "which data types belong to Number in js". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Type number output data content situation more knowledge error utility special security addition subtraction multiplication and division learning next representative just dilemma character string. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Technology vpn Redmi macOS