JS Syntax
let variableName = value;
function functionName(parameter) {
return value;
}
object.property
Values
Value डेटा का एक अकेला टुकड़ा है जिसके साथ JavaScript काम कर सकती है, जैसे कोई संख्या, कोई text, या true और false, और values वह कच्चा माल हैं जिसे हर JavaScript program संचालित करता है।
उदाहरण: Values
// Print `5` to the console
// Print `5` to the console
console.log(5);
// Print "hello" to the console
// Print "hello" to the console
console.log("hello");
// Print `true` to the console
// Print `true` to the console
console.log(true);
Operators
Operators वे symbols हैं जो values पर क्रियाएँ करते हैं, जैसे संख्याएँ जोड़ने या text जोड़ने के लिए +, और variable में value रखने के लिए =, जो किसी expression में values के बीच जोड़ने वाली कड़ी बनाते हैं।
उदाहरण: Operators
console.log(2 + 3);
console.log("Hello" + " World");
Expressions
Expression कोई भी code का टुकड़ा है जो एक value बनाता है, एक साधारण literal से लेकर operators और function calls के जटिल संयोजन तक, और expressions वे टुकड़े हैं जिनसे statements बनते हैं।
उदाहरण: Expressions
let result = 2 + 3 * 4;
console.log(result);
Keywords और Identifiers
Keywords JavaScript में विशेष अर्थ वाले आरक्षित शब्द हैं, जैसे const, function और if, जिन्हें आप अपने नामों के रूप में इस्तेमाल नहीं कर सकते, जबकि identifiers वे कस्टम नाम हैं जो आप अपने code के variables, functions और अन्य हिस्सों के लिए चुनते हैं।
उदाहरण: Keywords and Identifiers
const userEmail = "[email protected]";
console.log(userEmail);
Case Sensitivity और camelCase
JavaScript पूरी तरह case sensitive है, यानी userName और username दो बिलकुल अलग identifiers माने जाते हैं, और variables तथा functions के नामकरण की सामुदायिक परंपरा camelCase है, जहाँ पहला शब्द छोटे अक्षरों में और बाद का हर शब्द बड़े अक्षर से शुरू होता है।
उदाहरण: Case Sensitivity and camelCase
// Declare the variable `userName`, set to "Alice"
// Declare the variable `userName`, set to "Alice"
let userName = "Alice";
// Declare the variable `username`, set to "Bob"
// Declare the variable `username`, set to "Bob"
let username = "Bob";
// Print `userName, username` to the console
// Print `userName, username` to the console
console.log(userName, username);
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: