Exercises: JavaScript Variables
--
-
- Declaring Variables -
- Working with Strings -
- Primitive Type Practice -
diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/JavaScript_Variables b/JavaScript_Variables new file mode 160000 index 0000000..e36036e --- /dev/null +++ b/JavaScript_Variables @@ -0,0 +1 @@ +Subproject commit e36036e07f564aff9a734672a9ba7edf8bbbd379 diff --git a/README.md b/README.md index d222c0c..8097a3c 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,55 @@ ---- -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) +--- +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) diff --git a/app.js b/app.js index c5fc982..2587fcd 100644 --- a/app.js +++ b/app.js @@ -1,10 +1,36 @@ -console.log("Hello World!\n==========\n"); -console.log( - "Follow the steps in the README.md file to complete the exercises:\n==========\n" -); - -// Exercise 1 - -// Exercise 2 - -// Exercise 3 + +"Follow the steps in the README.md file to complete the exercises:\n==========\n" + + + +//Excercise 1 +const firstName = "Rosie"; +let lastName = "Cotton"; +var age = 15; + +let language = "JavaScript"; +let createdYear = 1995; +let isCaseSensitive = "true"; + +console.log(`${language} was first release in ${createdYear}.`); + +let product = "T-shirty" +Let price = 19.99; +let isOnSale = false; +let salePercentage = 15; +let inStock = false; +let selectSize = "M"; + + + + + +} + +Let title = "Name of the Wind"; +Let author = Patrick Rothfuss; +Let pageCount = 722; +let bookMark = 456; +let hasRead = true; + +console.log ('${title} by ${author} is ${pageCount} pages long.`) diff --git a/index.html b/index.html index 5e6a97f..342f81a 100644 --- a/index.html +++ b/index.html @@ -1,21 +1,31 @@ - - -
- - -