176k views
1 vote
Q4. Write down the JavaScript statements to perform the following tasks.

i. Accept the value of base, height and length.
ii. Declare three variables base, height and length.​

User Nate Levin
by
4.1k points

1 Answer

2 votes

Answer:

Step-by-step explanation:

In Javascript, you can accept an input value by using the prompt() function and saving the input into a variable. In the following lines of code, I have declared the three variables at the beginning and then prompted the user to enter a value for each and saved the values in the correct variables. In Javascript length is a keyword so I used len instead.

let base, height, len;

base = prompt("Enter Base value: ");

height = prompt("Enter Height value: ");

len = prompt("Enter Length value: ");

User Jerard
by
4.3k points