JavaScript Exercise Set 1

Comprehension Questions

  1. What does console.log() do?

Programming Questions

1. Basic Calculator

Create a program with two variables: num1 and num2.

  • Assign a numeric value to

  • Calculate the result of addition, subtraction, multiplication and division, and you are to store each result in variables

  • Output the result with proper string formatting using console.log()

2. Name & Age Program

Create a program that does the following:

  • Create variables that holds your first name, last name, and your age.

  • Then output out the following:

Hello [FIRST NAME] [LAST NAME] You are [AGE] years old.

Replace the content with within the square brackets [] to the variables you created.

3. Update Question 1 & 2

Create new programs such that the variables you created can be assigned with the result of the prompt() function.

Last updated