In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to define constants in javascript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to define constants in javascript.
Javascript can use the const keyword to define constants, the keyword can define one or more constants, the definition must be initialized, and the initialization value can no longer be modified; syntax "const variable name = value;" or "const variable name 1 = value 1, variable name 2 = value 3, variable name n = value n;"
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
A constant is a quantity that cannot be changed and is usually used to store data that is neither changed nor desired; the value of the constant remains unchanged throughout the running of the script code and cannot be re-modified.
In javascript, you can use the const keyword to define constants.
Const can define one or more constants, which must be initialized at the time of definition, and the value cannot be modified after initialization.
Syntax:
Const variable name = value; const variable name 1 = value 1, variable name 2 = value 3, and variable name n = value n
Note: constants, like variables, are containers for storing data, except that the value of the constant cannot be changed during the run of the program, otherwise an error will be reported at run time.
Example:
Try {const PI = 3.141592653589793; PI = 3.14;} catch (err) {document.getElementById ("demo") [xss_clean] = err;} Thank you for your reading, the above is the content of "how to define constants in javascript". After the study of this article, I believe you have a deeper understanding of how to define constants in javascript. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.