10 points
Write a JavaScript code to input your name and age. If name is Divya and age is 16. Then display the statement 'Divya is 16 years old' as output.
⚫No spamming plz
Answers
Answered by
12
Hi,
__________________________________________
var name, age;
name = prompt('Please enter you name: ');
age = prompt('Please enter your age: ');
alert(name + ' is ' + age + ' years old.');
__________________________________________
please let me know if you want to display output only if name is "Divya" and
age is "16"?? let me know.. i will edit.
Because above code will return output whatever you will enter.
Answered by
1
Explanation:
Different Types of Conditional Statements
There are mainly three types of conditional statements in JavaScript.
- If statement
- If…Else statement
- If…Else If…Else statement
Similar questions