Manwal ng Palatuntunan ng Statement ng JavaScript
- Previous Page JS Operator Precedence
- Next Page JS Typed Arrays
JavaScript Statements
Sa HTML, ang mga statement ng JavaScript ay ang "inutusan" na ipatupad ng Web browser.
Ang katunayan ay nagsasabi sa browser na isulat sa HTML elementong may id="demo" ang "Hello Kitty":
Example
document.getElementById("demo").innerHTML = "Hello Kitty";
Para sa mas maraming kaalaman tungkol sa mga statement, basahin ang aming JavaScript Statement Tutorial.
JavaScript Statement Identifier
Ang mga statement ng JavaScript ay karaniwang nagsisimula sa identifier ng statement, na ginagamit upang i-identify ang aksyon na gagawin ng JavaScript.
Ang mga identifier ng statement ay reserved words, at hindi puwedeng gamitin bilang pangalan ng variable (o anumang bagay na ibang).
Ang sumusunod na talahanan ay naglilista ng lahat ng identifier ng statement ng JavaScript:
Statement | Description |
---|---|
break | Exit the switch or loop. |
class | Declare a class. |
const | Declare variables with a constant value. |
continue | If a specified condition occurs, interrupt the loop (in the loop) once and continue to the next iteration in the loop. |
debugger | Stop executing JavaScript and call debugging features (if any). |
do ... while | Execute a statement block and repeat the statement block when the condition is true. |
for | Loop through a code block multiple times. |
for ... in | Loop through the properties of an object. |
for ... of | Loop through the values of an iterable object. |
function | Declare a function. |
if ... else ... else if | Mark the statement block to be executed based on a condition. |
let | Declare variables within the scope of the brackets {}. |
return | Stop executing the function and return a value from the function. |
switch | Mark the statement block to be executed based on different conditions. |
throw | Throw (generate) an error. |
try ... catch ... finally | Mark the statement block to be executed when an error occurs in the try block, and implement error handling. |
var | Declare variables. |
while | Statement block to be executed when the condition is marked as true. |
- Previous Page JS Operator Precedence
- Next Page JS Typed Arrays