In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the js data type of the digital type of the example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Let's take a specific look at one of the data types of js.
First, the data types of javaScript (hereinafter referred to as js) are divided into two types: original type and object type. The original types of js include numbers, strings, and Boolean values.
Js has two special primitive values: null (null) and undefined (undefined), which are not numbers, strings, and Boolean values. They usually represent the unique members of their respective special types.
Third, js in addition to numbers, strings, Boolean values, null and undefined is the object, objects (object) is a collection of attributes, each attribute by the "name / value pair" (the value can be the original value, such as a number, string, can also be an object).
4. An ordinary js object is an unordered collection of named values. Js also defines a special object, the array, which represents an ordered collection of numbered values. Js defines the syntax for arrays, which we'll talk about in more detail later. Make the array have some unique behavior characteristics that are different from ordinary objects.
5. Js also defines a special object-function. A function has an object with executable code associated with it, runs the executable code by calling the function, and returns the run result. Like arrays, functions behave differently from other objects.
6. If the function is used to initialize (using the new operator) a newly created object, we call it a constructor, and each constructor defines a class object
Next, I will specifically explain to you the first type of data type-- numbers.
According to the number format in js, the range of integers that can be represented is from-9007199254740992 to 9007199254740992 (that is,-253 to 253) containing boundary values.
In js, when a number appears directly in the js program, we call it digital direct quantities, and js supports digital direct quantities in multiple formats.
An integer direct quantity that uses a sequence of numbers to represent a decimal integer, such as 0 3 133333
Floating-point direct quantities, floating-point direct quantities can contain decimal points, such as: 3333 2.02e+11 trillion (2.02x1023) e or what power E stands for
Arithmetic operations in js (+ (addition),-(minus), x (multiplication), / (except),% (remainder)) in addition to these basic operators, js supports more complex arithmetic operations, which are implemented through functions and constants defined as properties of the Math object:
The 53th power of Math.pow (2Jing 53) / / 2 is 8007199254740992 Math.round (.6) / / 1.0rounding Math.ceil (.6) / / 1.0 rounding up Math.floor (.6) / / 0.0 rounding Math.abs (- 5) / / 5 to the absolute value Math.max (x .z) / / returns the maximum value Math.min (x .z) / / returns the minimum value Math.random () / / generates a pseudo-random number Math.PI / / π pi Math.E / / e the square root Math.pow (3) / / 3 of the base Math.sqrt (3) / / 3 of the natural logarithm Math.pow (3) / / 3 .sin (0) / / trigonometric function: there are also cos () and atan.
Js uses the IEEE-754 floating point representation, which is a binary representation that can accurately represent fractions, such as 1max 2, 1max 8 and 1max 1024, but our commonly used fractions are decimal fractions such as 1max 10 and 1max 100, etc. The binary floating point representation does not accurately represent a number as simple as 0.1.
such as
0.3-0.2 is not equal to 0.2-0.1. in the real operating environment, 0.3-0.2mm 0.099999999999999999999990.1.Thank you for reading this article carefully due to rounding errors. I hope the article "sample Analysis of js data types of Digital types" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.