-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
JS Basics
JS Variables & Operators
JS Data Types & Conversion
JS Numbers & Math
JS Strings
JS Dates
JS Arrays
JS Control Flow
JS Loops & Iteration
JS Functions
JS Functions
Function Definitions
Function Parameters
Function Invocation
Function Call
Function Apply
Function Bind
Function Closures
JS Arrow Function
JS Objects
JS Objects
JS Object Properties
JS Object Methods
JS Object Display
JS Object Constructors
Object Definitions
Object Get / Set
Object Prototypes
Object Protection
JS Classes & Modules
JS Async Programming
JS Advanced
JS Destructuring
JS Bitwise
JS RegExp
JS Precedence
JS Errors
JS Scope
JS Hoisting
JS Strict Mode
JS this Keyword
JS HTML DOM
DOM Intro
DOM Methods
DOM Document
DOM Elements
DOM HTML
DOM Forms
DOM CSS
DOM Animations
DOM Events
DOM Event Listener
DOM Navigation
DOM Nodes
DOM Collections
DOM Node Lists
JS BOM (Browser Object Model)
JS Window
JS Screen
JS Location
JS History
JS Navigator
JS Popup Alert
JS Timing
JS Cookies
Web Storage API
JS Web APIs
JS AJAX
AJAX Intro
AJAX XMLHttp
AJAX Request
AJAX Response
AJAX XML File
AJAX PHP
AJAX ASP
AJAX Database
AJAX Applications
AJAX Examples
JS JSON
JSON Intro
JSON Syntax
JSON vs XML
JSON Data Types
JSON Parse
JSON Stringify
JSON Objects
JSON Arrays
JSON Server
JSON PHP
JSON HTML
JSON JSONP
JS Canvas
JS Graphics & Charts
JS Basics
JS Variables & Operators
JS Data Types & Conversion
JS Numbers & Math
JS Strings
JS Dates
JS Arrays
JS Control Flow
JS Loops & Iteration
JS Functions
JS Functions
Function Definitions
Function Parameters
Function Invocation
Function Call
Function Apply
Function Bind
Function Closures
JS Arrow Function
JS Objects
JS Objects
JS Object Properties
JS Object Methods
JS Object Display
JS Object Constructors
Object Definitions
Object Get / Set
Object Prototypes
Object Protection
JS Classes & Modules
JS Async Programming
JS Advanced
JS Destructuring
JS Bitwise
JS RegExp
JS Precedence
JS Errors
JS Scope
JS Hoisting
JS Strict Mode
JS this Keyword
JS HTML DOM
DOM Intro
DOM Methods
DOM Document
DOM Elements
DOM HTML
DOM Forms
DOM CSS
DOM Animations
DOM Events
DOM Event Listener
DOM Navigation
DOM Nodes
DOM Collections
DOM Node Lists
JS BOM (Browser Object Model)
JS Window
JS Screen
JS Location
JS History
JS Navigator
JS Popup Alert
JS Timing
JS Cookies
Web Storage API
JS Web APIs
JS AJAX
AJAX Intro
AJAX XMLHttp
AJAX Request
AJAX Response
AJAX XML File
AJAX PHP
AJAX ASP
AJAX Database
AJAX Applications
AJAX Examples
JS JSON
JSON Intro
JSON Syntax
JSON vs XML
JSON Data Types
JSON Parse
JSON Stringify
JSON Objects
JSON Arrays
JSON Server
JSON PHP
JSON HTML
JSON JSONP
JS Canvas
JS Graphics & Charts
A JavaScript statement is an instruction that the browser executes. A program is essentially a series of statements.
let x = 5;
let y = 6;
let z = x + y;
Each of the lines above is a statement, and together they perform a task — adding two numbers and storing the result.
Used to declare variables or constants.
let name = "John";
const age = 25;
Used to assign values to variables.
x = 10;
y = x + 5;
Used to make decisions in code.
if (x > 5) {
console.log("x is greater than 5");
}
Used to repeat blocks of code.
for (let i = 0; i < 5; i++) {
console.log(i);
}
Used to call functions.
alert("Hello!");
JavaScript automatically inserts semicolons in most cases. However, it's a good practice to explicitly use semicolons to avoid errors, especially in large or complex programs.
let a = 5;
let b = 10;
let sum = a + b;
JavaScript code blocks are written inside curly braces {}
, typically in control flow structures like if
, for
, and while
.
if (true) {
console.log("This is a block of code.");
}
Q1. How do you declare a variable price
with a value of 100
in JavaScript?
Q2. How can you write a JavaScript statement to assign the sum of two variables x
and y
to a third variable total
?
Q3. How do you write a conditional statement that checks if a variable age
is greater than 18 and logs "Adult" if true?
Q4. How do you write a loop that prints numbers from 1 to 5 using a for
loop statement?
Q5. How do you write a function call statement that displays "Welcome!" using the alert()
method?
Q6. How do you group two or more statements inside a code block using {}
in JavaScript?
Q7. How do you create a constant variable named PI
with the value 3.14
?
Q8. What is the correct way to write multiple statements on separate lines with semicolons? Provide an example.
Q9. How do you write a statement that multiplies two numbers and stores the result in a variable named product
?
Q10. How do you declare a variable status
, assign it a string "active", and log it to the console?
Q1: Which of the following is a valid JavaScript statement?
Q2: Which symbol is typically used to end a JavaScript statement?
Q3: What is the purpose of a JavaScript statement?
Q4: Which of the following is an example of a conditional statement?
Q5: Which of the following keywords is used to declare a block-scoped variable?
Q6: Which of the following is not a JavaScript statement?
Q7: What is the correct way to write a code block in JavaScript?
Q8: Which statement calls a function in JavaScript?
Q9: Which keyword is used to declare a constant in JavaScript?
Q10: What happens if you omit the semicolon in JavaScript?