JavaScript Exercise Set 1
Comprehension Questions
What does
console.log()
do?What symbols do you use to create a comment, and why would you write a comment in your code?
What is a variable?
What are the 4 rules when naming a variable?
What keyword do you use when creating a variable?
Can two variables share the same name?
What is the difference between variable assignment/creation and variable update?
List the 7 primitive data types in JavaScript
Why would programmers need the modulus operator?
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
Last updated