- 2020-12-07 03:57:31
1. Object - and event-driven scripting language with defined security developed by Netscape.
g) example: The HTML file has built-in scripts
Usually we add a semicolon at the end of each executable statement.
Another use of semicolons is to write multiple statements in one line.
Tip: You might also see a case without a semicolon.
The browser executes each statement in the order in which it was written.
Blocks start with an open curly bracket and end with a close curly bracket.
The block is used to execute sequence 1 of statements.
The following example runs a function that operates on two HTML elements:
The function getElementById is different from getElementbyID.
Similarly, the variable myVariable is different from MyVariable.
A one-line comment begins with //.
Multiline comments begin with /* and end with */.
Variables can be short names (such as x and y) or more descriptive names (such as age, sum, totalvolume).
The & # 8226; Variables must begin with a letter
The & # 8226; Variables can also start with the $and _ symbols (though we don't recommend this)
The & # 8226; Variable names are case sensitive (y and Y are different variables)
When you assign a text value to a variable, you should enclose the value in double or single quotes.
Do not use quotes when you assign a value to a variable as a numeric value. If you enclose a value in quotation marks, the value is treated as text.
Using timed events in JavaScritp is easy, and the two key methods are:
setTimeout() executes the code at some point in the future
clearTimeout (cancelled) setTimeout ()