Computer Science, asked by creamiepie, 1 year ago

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 Anonymous
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 HeartHacker011
1

Explanation:

Different Types of Conditional Statements

There are mainly three types of conditional statements in JavaScript.

  1. If statement
  2. If…Else statement
  3. If…Else If…Else statement
Similar questions