In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "JavaScript has several constants". In daily operation, I believe many people have doubts about several constant problems in JavaScript. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "JavaScript has several constants"! Next, please follow the editor to study!
JavaScript has five kinds of constants, which are: 1, integer constant, which is actually positive; 2, real constant, which is actually decimal; 3, string constant, which is actually enclosed in single or double quotes; 4, Boolean constant; 5, custom constant, using "const constant name = constant value;" sentence definition.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
What is a constant?
Constants represent some fixed data
In real life, a person's gender can actually be regarded as a constant, born a boy all his life, a girl all his life.
Classification of constants in JavaScript
Integer constant
An integer constant is actually a positive number, and any integer written in JavaScript is an integer constant.
1 / 666 / 99
Real constant
A real constant is actually a decimal, and any decimal written in JavaScript is a real constant.
3.14 / 6.66
String constant
A string constant is actually something enclosed in single or double quotation marks, which we call a string constant.
'a'
'abc'
"1"
"BNTang"
Note: no matter how many characters are enclosed in single or double quotation marks, they are string constants in JavaScript
Boolean constant
Boolean constants are actually true or false, expressed by true and false in JavaScript
Boolean constants have only two values in JavaScript, true (true) or false (false)
Custom constant
New to ES6
Const constant name = constant value
Const NUM = 666 NUM / NUM = 888; / / if you try to modify the value of the constant, you will find that it is wrong. Once the constant is defined, you can no longer change the value of console.log (NUM). At this point, the study of "there are several constants of JavaScript" is over. I hope you can 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.