जावास्क्रिप्ट स्टेटमेंट संदर्भ
जावास्क्रिप्ट स्टेटमेंट्स
एचटीएमएल में, जावास्क्रिप्ट स्टेटमेंट वेब ब्राउज़र द्वारा "निष्पादित" होने के लिए "निर्देश" हैं।
यह कथन ब्राउज़र को "हैलो डॉली" लिखने के लिए कहता है। आईडी = "डेमो" के साथ एक HTML तत्व के अंदर:
उदाहरण
document.getElementById("demo").innerHTML = "Hello Dolly.";
स्टेटमेंट्स के बारे में एक ट्यूटोरियल के लिए, हमारा जावास्क्रिप्ट स्टेटमेंट ट्यूटोरियल पढ़ें ।
जावास्क्रिप्ट कथन पहचानकर्ता
JavaScript कथन अक्सर किए जाने वाले JavaScript क्रिया की पहचान करने के लिए एक कथन पहचानकर्ता के साथ प्रारंभ होते हैं।
स्टेटमेंट आइडेंटिफ़ायर आरक्षित शब्द हैं और इन्हें वेरिएबल नामों (या किसी अन्य चीज़) के रूप में उपयोग नहीं किया जा सकता है।
निम्न तालिका सभी JavaScript कथन पहचानकर्ताओं को सूचीबद्ध करती है:
Statement | Description |
---|---|
break | Exits a switch or a loop |
class | Declares a class |
const | Declares a variable with a constant value |
continue | Breaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop |
debugger | Stops the execution of JavaScript, and calls (if available) the debugging function |
do ... while | Executes a block of statements and repeats the block while a condition is true |
for | Loops through a block of code a number of times |
for ... in | Loops through the properties of an object |
for ... of | Loops through the values of an iterable object |
function | Declares a function |
if ... else ... else if | Marks a block of statements to be executed depending on a condition |
let | Declares a variable |
return | Stops the execution of a function and returns a value from that function |
switch | Marks a block of statements to be executed depending on different cases |
throw | Throws (generates) an error |
try ... catch ... finally | Marks the block of statements to be executed when an error occurs in a try block, and implements error handling |
var | Declares a variable |
while | Marks a block of statements to be executed while a condition is true |