COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
writing a for-loop
|
|
writing a while loop
|
|
making a list
|
|
writing an if statement
|
|
writing an if-else statement
|
Detailed explanation-1: -We can also write multiple conditions inside a single if statement with the help of the logical operators && and | | . The && operators will evaluate if one condition AND another is true. Both must be true before the code in the code block will execute.
Detailed explanation-2: -Javascript offers a ternary operator which acts like a one-line if / else statement with a single condition. It works really well for conditionally assigning a value to a variable.
Detailed explanation-3: -1) if statement if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not. If a certain condition is true then a block of statement is executed otherwise not.