title | slug |
---|---|
Exercise: JS Introduction and Variables |
/js-introduction-and-variables-exercise |
Your objective is to begin using variables to store and pass values throughout your program.
To see your work, you can log, or print, the values stored in your variables to the console. Use
console.log(variableName)
to see your results in the browser console.
Steps are to be completed in the app.js
file.
- Declare a variable named
firstName
using theconst
keyword - Declare a variable named
lastName
using thelet
keyword - Declare a variable named
age
using thevar
keyword
Steps are to be completed in the app.js
file.
- Assign your first name as the string value to the variable
firstName
- Assign your last name as the string value to the variable
lastName
- Assign your age as the number value to the variable
age
Steps are to be completed in the app.js
file.
- Declare a variable named
language
using thelet
keyword, and assign it the value"JavaScript"
(string) - Declare a variable named
createdYear
using thelet
keyword, and assign it the value1995
(number) - Declare a variable named
isCaseSensitive
using thelet
keyword, and assign it the valuetrue
(boolean)
Steps are to be completed in the app.js
file.
- Declare a variable named
price
using thelet
keyword, and assign it the value19.99
(number) - Declare a variable named
isOnSale
using thelet
keyword, and assign it the valuefalse
(boolean) - Declare a variable named
salePercentage
using thelet
keyword, and assign it the value15
(number) - Declare a variable named
stock
using thelet
keyword, and assign it the value0
(number) - Declare a variable named
inStock
using thelet
keyword, and assign it the valuefalse
(boolean) - Declare a variable named
selectedSize
using thelet
keyword, and assign it the value"M"
(string)
Steps are to be completed in the app.js
file.
- Declare a variable named
title
using thelet
keyword, and assign it the value"Name of the Wind"
(string) - Declare a variable named
author
using thelet
keyword, and assign it the value"Patrick Rothfuss"
(string) - Declare a variable named
pageCount
using thelet
keyword, and assign it the value722
(number) - Declare a variable named
bookmark
using thelet
keyword, and assign it the value456
(number) - Declare a variable named
hasRead
using thelet
keyword, and assign it the valuetrue
(boolean)