In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what are the simple data types of JavaScript". In the daily operation, I believe that many people have doubts about the simple data types of JavaScript. The editor consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "what are the simple data types of JavaScript?" Next, please follow the editor to study!
There are only two basic elements in the programming world, one is data and the other is code. The programming world is showing infinite vigor and vitality in the intertwined entanglement of data and code.
Data is inherently quiet and always wants to maintain its inherent identity, while code is naturally lively and always wants to change the world.
You see, the relationship between data codes is strikingly similar to that between matter and energy. The data also has inertia, and if there is no code to exert external force, she always maintains her original state. The code is like energy, the only purpose of its existence is to try to change the original state of the data. When the code changes the data, it will also affect or change the original trend of the code because of the resistance of the data. Even in some cases, data can be converted into code, which may be converted into data, and there may be a digital conversion equation similar to E=MC2. However, in the contradictory and unified operation between data and code, it can always reflect the laws of the computer world, which are the program logic we write.
However, because different programmers have different worldviews, the data and code look different. Therefore, programmers with different world views use their own methodology to promote the evolution and development of the programming world.
Return to simplicity
To understand JavaScript, you have to first put aside the concepts of objects and classes and go back to the origin of the data and code. As mentioned earlier, there are only two basic elements in the programming world: data and code, and these two elements are intertwined. JavaScript is to simplify the data and code to the most primitive level.
The data in JavaScript is very concise. There are only five kinds of simple data, undefined,null,boolean,number and string, and only one kind of complex data, that is, object. This is like Chinese classical simple materialism, which classifies the most basic elements of the world as gold, wood, water, fire and earth, and other complex materials are made up of these five basic elements.
There is only one form of code in JavaScript, which is function.
Note: the above words are all lowercase and should not be confused with JavaScript built-in functions such as Number,String,Object,Function. You know, the JavaScript language is case sensitive!
The identities, constants, variables, and parameters of any JavaScript are just one of the unfined,null,bool,number,string,object and function types, which is the type indicated by the typeof return value. There is no other type.
Tell me about simple data types.
Undefined: stands for all the unknown things, nothing, unimaginable, the code is even more impossible to deal with.
Note: typeof (undefined) also returns undefined.
You can assign a undefined to any variable or attribute, but that does not mean that the variable is cleared, but there is an extra attribute.
Null: there's a concept, but there's nothing. There seems to be something in nothing, but there is nothing in it. It's hard to imagine, but you can already deal with it in code.
Note: typeof (null) returns object, but null is not object, and variables with null values are not object.
Boolean: yes is, no is not, there is no doubt. Right is right, wrong is wrong, absolutely clear. It can not only be handled by the code, but also control the flow of the code.
Number: linear things, distinct in size and order, many but not messy. It is convenient for the code to be processed in batches, and it also controls the iteration and loop of the code.
Note: both typeof (NaN) and typeof (Infinity) return number.
The structure in which NaN participates in any numerical calculation is NaN, and nan is composed of nan.
Infinity/Infinity=NaN .
String: rational things for human beings, not machine signals. Man-machine information communication, code to understand people's intentions, and so on, all depend on it.
Simple types are not objects, and JavaScript does not give these simple types the ability to objectify. Identifiers, variables, and parameters that are directly assigned a constant value of a simple type are not an object.
Objectification is the ability to organize data and code into complex structures. Only object and function types in JavaScript provide the ability to objectify.
At this point, the study of "what are the simple data types of JavaScript" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.