Menu

Post image 1
Post image 2
1 / 2
0

Javascript- literals and keywords

DEV Community·sai sanjana·17 days ago
#6GlBqjMk
Reading 0:00
15s threshold

Hi all, --JavaScript Literals Literals are the simplest way to represent values in JavaScript. They are written directly into the program without needing computation. Types of Literals Number literals: Represent numeric values. Example: 42, 3.14. String literals: Text enclosed in quotes. Example: "Hello", 'World'. Boolean literals: Logical values true or false. Null literal: Represents an empty or non-existent value. Example: null. Undefined literal: Indicates a variable has been declared but not assigned. Object literals: Define objects directly. Array literals: Define lists of values. Example: [1, 2, 3]. --JavaScript Keywords Keywords are reserved words that cannot be used as variable names or identifiers because they have predefined roles in the language. Categories of Keywords Declaration keywords: var, let, const — used to declare variables. Control flow keywords: if, else, switch, case, default. Looping keywords: for, while, do, break, continue. Function-related keywords: function, return, yield.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More