-
Notifications
You must be signed in to change notification settings - Fork 179
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
125 changed files
with
4,052 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
1 change: 0 additions & 1 deletion
1
...r 01/Code Samples/Please put your code files in this directory with naming_convention.txt
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//alert("Saying hi from a different file!"); | ||
prompt("Hi! How are you?"); |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<script type="text/javascript"> | ||
alert("Hi there!"); | ||
</script> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<html> | ||
<script type="text/javascript" src="ch1_alert.js"></script> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
let status = "new"; | ||
let scared = true; | ||
if (status === "new") { | ||
console.log("Welcome to JavaScript!"); | ||
if (scared) { | ||
console.log("Don't worry you will be fine!"); | ||
} else { | ||
console.log("You're brave! You are going to do great!"); | ||
} | ||
} else { | ||
console.log("Welcome back, I new you'd like it!"); | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let bool1 = false; | ||
let bool2 = true; | ||
console.log(typeof bool1) | ||
|
||
let str1 = "JavaScript is fun!"; | ||
let str2 = "JavaScript is fun!"; | ||
console.log("These two strings are the same:", str1 === str2); | ||
|
||
let sym1 = Symbol("JavaScript is fun!"); | ||
let sym2 = Symbol("JavaScript is fun!"); | ||
console.log("These two Symbols are the same:", sym1 === sym2); |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// let nr1 = 2; | ||
// let nr2 = "2"; | ||
// console.log(nr1 * nr2); | ||
|
||
// let nr1 = 2; | ||
// let nr2 = "2"; | ||
// console.log(nr1 + nr2); | ||
|
||
// let nrToStr = 6; | ||
// nrToStr = String(nrToStr); | ||
// console.log(nrToStr, typeof nrToStr); | ||
|
||
// let strToNr = "12"; | ||
// strToNr = Number(strToNr); | ||
// console.log(strToNr, typeof strToNr); | ||
|
||
// let strToBool = "any string will return true"; | ||
// strToBool = Boolean(strToBool); | ||
// console.log(strToBool, typeof strToBool); | ||
|
||
// let nullToNr = null; | ||
// nullToNr = Number(nullToNr); | ||
// console.log("null", nullToNr, typeof nullToNr); | ||
|
||
// let strToNr = ""; | ||
// strToNr = Number(strToNr); | ||
// console.log("empty string", strToNr, typeof strToNr); | ||
|
||
// let strToNr2 = "hello"; | ||
// strToNr2 = Number(strToNr2); | ||
// console.log(strToNr2, typeof strToNr2); | ||
|
||
// let strToBool = ""; | ||
// strToBool = Boolean(strToBool); | ||
// console.log(strToBool, typeof strToBool); | ||
|
||
// let strToBool2 = "false"; | ||
// strToBool2 = Boolean(strToBool2); | ||
// console.log(strToBool2, typeof strToBool2); | ||
|
||
// let nr1 = 2; | ||
// let nr2 = "2"; | ||
// console.log(nr1 + Number(nr2)); |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
let str = "Hello, what's your name? Is it \"Mike\"?"; | ||
console.log(str); | ||
let str2 = 'Hello, what\'s your name? Is it "Mike"?'; | ||
console.log(str2); | ||
|
||
let str3 = "New \nline." | ||
let str4 = "I'm containing a backslash: \\!"; | ||
console.log(str3); | ||
console.log(str4); | ||
|
||
let str = "Hello"; | ||
let nr = 7; | ||
let bigNr = 12345678901234n; | ||
let bool = true; | ||
let sym = Symbol("unique"); | ||
let undef = undefined; | ||
let unknown = null; | ||
|
||
console.log("str", typeof str); | ||
console.log("nr", typeof nr); | ||
console.log("bigNr", typeof bigNr); | ||
console.log("bool", typeof bool); | ||
console.log("sym", typeof sym); | ||
console.log("undef", typeof undef); | ||
console.log("unknown", typeof unknown); |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// let nr1 = 12; | ||
// let nr2 = 14; | ||
// let str1 = "Hello "; | ||
// let str2 = "addition"; | ||
// let result1 = nr1 + nr2; | ||
// let result2 = str1 + str2; | ||
// console.log(result1, result2); | ||
|
||
// let nr1 = 20; | ||
// let nr2 = 4; | ||
// let str1 = "Hi "; | ||
// let nr3 = 3; | ||
// let result1 = nr1 - nr2; | ||
// let result2 = str1 - nr3; | ||
// console.log(result1, result2); | ||
|
||
// let nr1 = 15; | ||
// let nr2 = 10; | ||
// let str1 = "Hi"; | ||
// let nr3 = 3; | ||
// let result1 = nr1 * nr2; | ||
// let result2 = str1 * nr3; | ||
// console.log(result1, result2); | ||
|
||
// let nr1 = 30; | ||
// let nr2 = 5; | ||
// let result1 = nr1 / nr2; | ||
// console.log(result1); | ||
|
||
// let nr1 = 2; | ||
// let nr2 = 3; | ||
// let result1 = nr1 ** nr2; | ||
// console.log(result1); | ||
|
||
// let nr1 = 10; | ||
// let nr2 = 3; | ||
// let result1 = nr1 % nr2; | ||
// console.log(`${nr1} % ${nr2} = ${result1}`); | ||
|
||
// let nr3 = 8; | ||
// let nr4 = 2; | ||
// let result2 = nr3 % nr4; | ||
// console.log(`${nr3} % ${nr4} = ${result2}`); | ||
|
||
// let nr5 = 15; | ||
// let nr6 = 4; | ||
// let result3 = nr5 % nr6; | ||
// console.log(`${nr5} % ${nr6} = ${result3}`); | ||
|
||
// let nr = 4; | ||
// nr++; | ||
// console.log(nr); | ||
|
||
// let nr = 2; | ||
// console.log(nr++); | ||
// console.log(nr); | ||
|
||
// let nr = 2; | ||
// console.log(++nr); | ||
|
||
let nr1 = 4; | ||
let nr2 = 5; | ||
let nr3 = 2; | ||
console.log(nr1++ + ++nr2 * nr3++); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let unassigned; | ||
console.log(unassigned); | ||
|
||
let terribleThingToDo = undefined; | ||
let lastname; | ||
console.log("Same undefined:", lastname === terribleThingToDo); | ||
|
||
let betterOption = null; | ||
console.log("Same null:", lastname === betterOption); | ||
|
||
let empty = null; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let firstname = "Maria"; | ||
firstname = "Jacky"; | ||
|
||
let nr1 = 12; | ||
var nr2 = 8; | ||
const pi = 3.14159; | ||
|
||
// throws a TypeError | ||
const someConstant = 3; | ||
someConstant = 4; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let intNr = 1; | ||
let decNr = 1.5; | ||
let expNr = 1.4e15; | ||
|
||
let bigNr = 90071992547409920n; | ||
// typeError | ||
let result = bigNr + intNr; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let singleString = 'Hi there!'; | ||
let doubleString = "How are you?"; | ||
|
||
let language = "JavaScript"; | ||
let message = `Let's learn ${language}`; | ||
console.log(message); |
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
arr1 = new Array("purple", "green", "yellow"); | ||
arr2 = ["black", "orange", "pink"]; | ||
|
||
arr3 = new Array(10); | ||
arr4 = [10]; | ||
|
||
console.log(arr3); | ||
console.log(arr4); | ||
|
||
cars = ["Toyota", "Renault", "Volkswagen"]; | ||
console.log(cars[0]); | ||
console.log(cars[1]); | ||
console.log(cars[2]); | ||
console.log(cars[3]); | ||
console.log(cars[-1]); | ||
|
||
cars[0] = "Tesla"; | ||
console.log(cars[0]); | ||
|
||
cars[3] = "Kia"; | ||
cars[-1] = "Fiat"; | ||
console.log(cars[3]); | ||
console.log(cars[-1]); | ||
|
||
colors = ["black", "orange", "pink"] | ||
booleans = [true, false, false, true]; | ||
emptyArray = []; | ||
|
||
console.log("Length of colors:", colors.length); | ||
console.log("Length of booleans:", booleans.length); | ||
console.log("Length of emtpy array:", emptyArray.length); | ||
|
||
lastElement = colors[colors.length - 1]; | ||
console.log(lastElement); | ||
|
||
numbers = [12, 24, 36]; | ||
numbers[-1] = 0; | ||
numbers[5] = 48; | ||
console.log(numbers.length); | ||
|
||
console.log("numbers", numbers); | ||
|
||
favoriteFruits = ["grapefruit", "orange", "lemon"]; | ||
favoriteFruits.push("tangerine"); | ||
|
||
let lengthOfFavoriteFruits = favoriteFruits.push("lime"); | ||
console.log(lengthOfFavoriteFruits); | ||
console.log(favoriteFruits); | ||
|
||
let arrOfShapes = ["circle", "triangle", "rectangle", "pentagon"]; | ||
arrOfShapes.splice(2, 0, "square", "trapezoid"); | ||
console.log(arrOfShapes); | ||
|
||
let arr5 = [1, 2, 3]; | ||
let arr6 = [4, 5, 6]; | ||
let arr7 = arr5.concat(arr6); | ||
console.log(arr7); | ||
|
||
let arr8 = arr7.concat(7, 8, 9); | ||
console.log(arr8); | ||
|
||
arr8.pop(); | ||
console.log(arr8); | ||
|
||
arr8.shift(); | ||
console.log(arr8); | ||
|
||
arr8.splice(1, 3); | ||
console.log(arr8); | ||
|
||
delete arr8[0]; | ||
console.log(arr8); | ||
|
||
let findValue = arr8.find(() => e === 6); | ||
let findValue2 = arr8.find(() => e === 8); | ||
console.log(findValue, findValue2); | ||
|
||
let findIndex = arr8.indexOf(6); | ||
let findIndex2 = arr8.indexOf(10); | ||
let findIndex3 = arr8.indexOf(6, 2); | ||
console.log(findIndex, findIndex2, findIndex3); | ||
|
||
let animals = ["dog", "horse", "cat", "platypus", "dog"] | ||
let lastDog = animals.lastIndexOf("dog"); | ||
console.log(lastDog); | ||
|
||
|
||
let names = ["James", "Alicia", "Fatiha", "Maria", "Bert"]; | ||
names.sort(); | ||
|
||
let ages = [18, 72, 33, 56, 40]; | ||
ages.sort(); | ||
|
||
console.log(names); | ||
console.log(ages); | ||
|
||
names.reverse(); | ||
console.log(names); | ||
|
||
console.log(typeof arr1); |
Oops, something went wrong.