In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to understand the var sentence of javascript". 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!
Var, which means "variable", is a keyword in javascript, which is mainly used to declare variables, and the syntax "var variable name;"; after the variable is declared, if the variable is not assigned a value, then these variables will be assigned an initial value "undefined".
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Var is a keyword in javascript that is mainly used to declare variables. The syntax format is as follows:
Var varname
The var statement can declare one or more variables and optionally initialize them to a value; if you define multiple variables, you need to separate the variable names with a comma, as shown in the following example:
Var varname1 [= value1] [, varname2 [= value2]... [, varnameN [= valueN]
Varname: variable name. The variable name can be defined as any legal identifier.
Value: the initialization value of the variable. The value can be any legal expression. The default is undefined.
After the variable is defined, if the variable is not assigned a value, then the variable is assigned an initial value-undefined (undefined).
After the variable is defined, you can assign a value to the variable using the equal sign =. The one to the left of the equal sign is the name of the variable, and the right side of the equal sign is the value to be assigned to the variable, as shown in the following example:
Var num; / / defines a variable numnum = 1; / / assigns the variable num to 1
Alternatively, you can assign values to variables while defining them, as shown in the following example:
Var num = 1; / / define a variable num and assign it to 1var a = 2, b = 3, c = 4; / / define three variables a, b, c at the same time and assign values as 2, 3, 4 var a = 2, / / to make the code look neater, the previous line of code can also be written like this / b = 3.
Extended data: keywords
A Keyword is a set of names (or commands) used internally in the JavaScript language. These names have a specific purpose, and users cannot customize identifiers with the same name, as shown in the table.
JavaScript keyword breakdeleteifthiswhilecasedointhrowwithcatchelseinstanceoftry
Continuefinallynewtypeof
Debugger (new to ECMAScript 5) forreturnvar
Defaultfunctionswitchvoid
This is the end of the content of "how to understand the var statement of javascript". 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!
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.