forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
//Create an array called practiceFile with the following entry: 273.15 | ||
|
||
let practiceFile = [] | ||
|
||
practiceFile.push(273.15) | ||
|
||
console.log(practiceFile) | ||
|
||
//Use the bracket notation method to add "42" and "hello" to the array. Add these new items one at a time. Print the array after each step to confirm the changes. | ||
|
||
practiceFile.push(42) | ||
|
||
console.log(practiceFile) | ||
|
||
practiceFile.push("hello") | ||
|
||
console.log(practiceFile) | ||
|
||
//Use a single .push() to add the following items: false, -4.6, and "87". Print the array to confirm the changes. | ||
|
||
practiceFile.push(false,-4,"87") | ||
|
||
console.log(practiceFile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
let pluralNoun = ; | ||
let name = ; | ||
let verb = ; | ||
let adjective = ; | ||
let color = ; | ||
let pluralNoun = "cats"; | ||
let name = "John"; | ||
let verb = "kick"; | ||
let adjective = "cold"; | ||
let color = "green"; | ||
|
||
console.log("JavaScript provides a "+ color +" collection of tools — including " + adjective + " syntax and " + pluralNoun + " — that allows "+ name +" to "+ verb +" with strings.") | ||
|
||
console.log( `Javascript provides a ${color} collection of tools - | ||
including ${adjective} syntax and ${pluralNoun} - | ||
that allows ${name} to ${verb} with strings.`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
let num = 1001; | ||
let numTwo= 123.45 | ||
|
||
//Returns 'undefined'. | ||
console.log(num.length); | ||
|
||
//Use type conversion to print the length (number of digits) of an integer. | ||
console.log(String(num).length) | ||
|
||
//Follow up: Print the number of digits in a DECIMAL value (e.g. num = 123.45 has 5 digits but a length of 6). | ||
console.log(String(numTwo).replace(".", "").length) | ||
|
||
//Experiment! What if num could be EITHER an integer or a decimal? Add an if/else statement so your code can handle both cases. | ||
|
||
if (String(numTwo).indexOf(".") >= 0) { | ||
console.log(String(numTwo).replace(".", "").length) | ||
} else { | ||
console.log(String(num).length) | ||
} | ||
|
||
console.log("Launch\nCode") | ||
|
||
let charles = ['coder', 'Tech', 47, 23, 350]; | ||
charles.sort(); | ||
console.log(charles); | ||
|
||
const school = [ | ||
["science", "computer", "art"], | ||
["Jones", "Willoughby", "Rhodes"] | ||
]; | ||
school[0].push("dance") | ||
console.log(school[0]) | ||
|
||
school[1].unshift("Holmes") | ||
console.log(school[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters