https://github.com/truecodersio/javascript_variables
https://github.com/truecodersio/javascript_variables
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/truecodersio/javascript_variables
- Owner: truecodersio
- Created: 2021-01-06T16:08:42.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-12T21:08:56.000Z (over 2 years ago)
- Last Synced: 2025-02-17T14:31:52.373Z (over 1 year ago)
- Language: HTML
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 614
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: "Exercise: JS Introduction and Variables"
slug: "/js-introduction-and-variables-exercise"
---
## Objective
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.
## Exercise 1: Declaring Variables
Steps are to be completed in the `app.js` file.
1. Declare a variable named `firstName` using the `const` keyword
2. Declare a variable named `lastName` using the `let` keyword
3. Declare a variable named `age` using the `var` keyword
## Exercise 2: Assigning Values to Variables
Steps are to be completed in the `app.js` file.
1. Assign your first name as the **string** value to the variable `firstName`
2. Assign your last name as the **string** value to the variable `lastName`
3. Assign your age as the **number** value to the variable `age`
## Exercise 3: Declaring and Assigning Values to Variables
Steps are to be completed in the `app.js` file.
1. Declare a variable named `language` using the `let` keyword, and assign it the value `"JavaScript"` (string)
2. Declare a variable named `createdYear` using the `let` keyword, and assign it the value `1995` (number)
3. Declare a variable named `isCaseSensitive` using the `let` keyword, and assign it the value `true` (boolean)
## Exercise 4: Declaring and Assigning Values to Variables x2
Steps are to be completed in the `app.js` file.
1. Declare a variable named `price` using the `let` keyword, and assign it the value `19.99` (number)
2. Declare a variable named `isOnSale` using the `let` keyword, and assign it the value `false` (boolean)
3. Declare a variable named `salePercentage` using the `let` keyword, and assign it the value `15` (number)
4. Declare a variable named `stock` using the `let` keyword, and assign it the value `0` (number)
5. Declare a variable named `inStock` using the `let` keyword, and assign it the value `false` (boolean)
6. Declare a variable named `selectedSize` using the `let` keyword, and assign it the value `"M"` (string)
## Exercise 5: Declaring and Assigning Values to Variables x3
Steps are to be completed in the `app.js` file.
1. Declare a variable named `title` using the `let` keyword, and assign it the value `"Name of the Wind"` (string)
2. Declare a variable named `author` using the `let` keyword, and assign it the value `"Patrick Rothfuss"` (string)
3. Declare a variable named `pageCount` using the `let` keyword, and assign it the value `722` (number)
4. Declare a variable named `bookmark` using the `let` keyword, and assign it the value `456` (number)
5. Declare a variable named `hasRead` using the `let` keyword, and assign it the value `true` (boolean)