Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
363 views
in Enterprise Resource Planning by (30.5k points)
closed by

Write down the control structures used in JavaScript.

1 Answer

+1 vote
by (30.4k points)
selected by
 
Best answer

Control structures in JavaScript. In general the execution of the program is sequential, we can change the normal execution by using the control structures. 

1. simple if 

Syntax: if(test expression) 

{

statements; 

First the test expression is evaluated, if it is true then the statement block will be executed otherwise not.

if-else 

Syntax:

First the test expression is evaluated, if it is true then the statement block1 will be executed otherwise statement block? will be evaluated. 

2. switch 

It is a multiple branch statement. Its syntax is given below.

switch(expression)

First expression evaluated and selects the statements with matched case value. 

Eg. switch (n)

3. for loop 

If a statement wants to execute more than once. 

Loop is used. 

for loop is an entry controlled loop. 

The syntax of for loop is given below 

For(initialisation; testing; updation) 

Body of the for loop;

}

4. while loop 

If a statement wants to execute more than once. 

Loop is used. 

It is also an entry controlled loop The syntax is given below

Loop variable initialised 

while(expression) 

{

Body of the loop; 

Update loop variable;

Here the loop variable must be initialised out side the while loop. Then the expression is evaluated if it is true then only the body of the loop will be executed and the loop variable must be updated inside the body. The body of the loop will be executed until the expression becomes false.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...