JavaScript Exercise Set 1

Comprehension Questions

  1. What does console.log() do?

  2. What symbols do you use to create a comment, and why would you write a comment in your code?

  3. What is a variable?

  4. What are the 4 rules when naming a variable?

  5. What keyword do you use when creating a variable?

  6. Can two variables share the same name?

  7. What is the difference between variable assignment/creation and variable update?

  8. List the 7 primitive data types in JavaScript

  9. Why would programmers need the modulus operator?

  10. What does it mean to do type casting?

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.

More Programming Questions

  1. Conveyor Belt Sushi (Link)

  2. Deliv-e-droid (Link)

  3. Cupcake Party (Link)

  4. Boiling Water (Link)

Last updated