Variable
# 1. conception
- Variables in 'FXS' are references to values.
- Variables that are not declared are directly assigned to use and will be defined as global variables.
- If only variables are declared and not assigned, the default value is 'undefined'.
- var behaves in line with JavaScript and will have variable boosts.
var foo = 1;
var bar = "hello world";
var i; i === undefined
The above code declares the three variables of 'foo', 'bar', and 'i'. Then, 'foo' is assigned the value '1' and 'bar' is assigned to the string ''hello world''.
# 2. The variable name
Variable naming must conform to the following two rules:
- The first character must be: letter (a-zA-Z), underscore (_)
- The remaining characters can be: letters (a-zA-Z), underscores (_), numbers (0-9)
# 3. Reserved identifiers
The following identifiers cannot be used as variable names:
delete
void
typeof
null
undefined
NaN
Infinity
var
if
else
true
false
require
this
function
arguments
return
for
while
do
break
continue
switch
case
default
Last update: 2022/08/11, 20:42:12