From 7231376dab0158a12031a683ca261a356ec714cd Mon Sep 17 00:00:00 2001 From: James Mercaldo Date: Mon, 24 Feb 2020 17:09:06 -0500 Subject: [PATCH 1/5] Create James --- James | 1 + 1 file changed, 1 insertion(+) create mode 100644 James diff --git a/James b/James new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/James @@ -0,0 +1 @@ + From 782f4862c2fd871583dabd67483f3fb5424dd1ef Mon Sep 17 00:00:00 2001 From: James Mercaldo Date: Mon, 24 Feb 2020 17:15:28 -0500 Subject: [PATCH 2/5] basic setup --- index.html | 14 ++++++++++++++ main.css | 0 2 files changed, 14 insertions(+) create mode 100644 index.html create mode 100644 main.css diff --git a/index.html b/index.html new file mode 100644 index 0000000..77f8a8a --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main.css b/main.css new file mode 100644 index 0000000..e69de29 From e780933256e12f13fef9476d6a6868759bd5a69d Mon Sep 17 00:00:00 2001 From: James Mercaldo Date: Mon, 24 Feb 2020 17:50:27 -0500 Subject: [PATCH 3/5] javascript added --- index.html | 5 +++-- intermediate.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 intermediate.js diff --git a/index.html b/index.html index 77f8a8a..04b5835 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,7 @@ - + - \ No newline at end of file + + \ No newline at end of file diff --git a/intermediate.js b/intermediate.js new file mode 100644 index 0000000..73d14aa --- /dev/null +++ b/intermediate.js @@ -0,0 +1,29 @@ +//and && +//or || (above enter key) + +var bool1 = true +var bool2 = false + +if (bool1 && bool2) { + console.log("AND") +} else if(bool1 || bool2) { + console.log("OR") +} + +// Ternary Operators +var result = (bool1) ? "The expression is true" : "The result is false"; +console.log(result); + +var profile = { + firstName: "Mark", + lastName: "Wahlberg", + state: "CT", + zipCode: "06269", + fullName: function() { + return profile.firstName + " " + this.lastName; //putting this.item is the same as putting the variableName.item + }, + +}; + +console.log(profile); +console.log(profile.fullName()); From 1275dd0508e4d1c6e67c6c2049ad0c8f1e80a2fd Mon Sep 17 00:00:00 2001 From: James Mercaldo Date: Mon, 24 Feb 2020 18:16:42 -0500 Subject: [PATCH 4/5] Update intermediate.js --- intermediate.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/intermediate.js b/intermediate.js index 73d14aa..a4f31bd 100644 --- a/intermediate.js +++ b/intermediate.js @@ -27,3 +27,27 @@ var profile = { console.log(profile); console.log(profile.fullName()); + +var array = ["CT", "MA", "NY", "RI", "NH", "VT", "ME"]; + +console.log(array.length); //length is an attribute that can be referenced without it being an item of a variable + +var name = "Frank"; +var length = name.length; +console.log(length); + +array.push("PA"); + +console.log(array.length); //push adds another item onto the array so now the length is 1 longer + +console.log(array[0]); + +delete array[1]; //deletes MA but leaves a "hole", it will leave the value but not the slot + +array.splice(3, 1) //deletes an item and removes the slot from the list, location then number of items to be removed +console.log(array) //RI is gone now + +array.forEach(function(item) { + console.log(item + "!"); +}) + From 29ed391d4c12195873e79a6eb1be3a62ded13ccc Mon Sep 17 00:00:00 2001 From: James Mercaldo Date: Wed, 26 Feb 2020 00:55:40 -0500 Subject: [PATCH 5/5] Update intermediate.js --- intermediate.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/intermediate.js b/intermediate.js index a4f31bd..78eebbb 100644 --- a/intermediate.js +++ b/intermediate.js @@ -51,3 +51,28 @@ array.forEach(function(item) { console.log(item + "!"); }) +//DATES + +var date = new Date(); //current time +console.log(date); + +var dateInput = new Date("02/24/2020") //easy way to set a date + +try { + if (something.length > 0) { + alert('the array exists'); + } +} catch { + console.log("there was an error in your try/catch") +} + +//JSON +var json = { + "firstName": "Joe", + "lastName": "Smith", + "state": "CT" +}; + +JSON.stringify(profile); +console.log(profile); +