The 3rd chapter gets the user's input
The prompt function is used to get the user's input. The function has two parameters//the function will "return the user's input as a string" Input 1 returns "1". String
Number, the first is the prompt that is displayed when the input is requested, and the other is the default value of the input. The function will use the
The user's input is returned as a string. The syntax is:
Strvariable=prompt ("Here is the prompt message displayed", "Here is the default input value");
The returned user input is saved in the variable strvariable.
3.2.2 What do you mean operator
An operator is a symbol that operates on the data, which expresses the actions to be performed on the data. Table 3.1 is
A list and description of all the operators in JavaScript.
[]: Brackets are used only to indicate the following table in the array
Ternary conditional operators are more complex, here is an example to explain. Ternary operator, which is considered to be used when the case is 2 choices, if the condition A is satisfied, which is executed, and if the condition B is satisfied, which
X=prompt ("Please enter a positive integer", "10");
Y=x>5? (x-5):(x*2);
alert (y);
S_str= "ABCDEFG". substring (1,4);
The result of the run, the content of S_str is "BCD". Note: The difference from the C # split: (1) from index=1 to End (1,4) 4 lengths starting from 1
JavaScript Summary (3)