From 51fedd479abe4d540311d59a7ad46c943bc91066 Mon Sep 17 00:00:00 2001 From: evantwidwell Date: Tue, 24 Mar 2020 19:49:27 -0500 Subject: [PATCH 1/4] adding my first helloworlds file --- 01week/helloworld.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 01week/helloworld.js diff --git a/01week/helloworld.js b/01week/helloworld.js new file mode 100644 index 000000000..319478385 --- /dev/null +++ b/01week/helloworld.js @@ -0,0 +1,3 @@ +'use strict' + +console.log("Hello World"); \ No newline at end of file From 3166ebc7c1c4d24050047eb3bd99aa09b4f8264c Mon Sep 17 00:00:00 2001 From: evantwidwell Date: Thu, 26 Mar 2020 18:24:09 -0500 Subject: [PATCH 2/4] 1st changes to dataypes assignment --- 01week/datatypes.js | 66 +++++++++++++++++++++++++++++++++++++++++++++ 01week/index.html | 11 ++++++++ 2 files changed, 77 insertions(+) create mode 100644 01week/index.html diff --git a/01week/datatypes.js b/01week/datatypes.js index e69de29bb..9d6af6f1a 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -0,0 +1,66 @@ +'Use Strict' + +// Write a JavaScript program to display the current day and time + +let now = new Date(); +console.log("the current date and time is: " + now); + +// Write a JavaScript program to convert a number to a string. + +const theNumber = 5; +const theString = theNumber.toString(); + +console.log(theNumber.toString()); +console.log(theNumber); + +// Write a JavaScript program to convert a string to the number. + +const theOtherString = "4.5"; +const theOtherNumber = parseInt(theOtherString, 10); +console.log(theOtherNumber); + +// Write a JavaScript program that takes in different datatypes and prints out whether they are a: +// Boolean +const myBool = true; +console.log(typeof myBool); +// Null +const myNull = null; +console.log(typeof myNull); +// Undefined +const myUndefined = undefined; +console.log(typeof myUndefined); +// Number +const myNumber = 3; +console.log(typeof myNumber); +// NaNconst +const myNaN = NaN; +console.log(typeof myNaN); + +// String +const myString = 'Joe'; +console.log(typeof myString); + +// Write a JavaScript program that adds 2 numbers together. +const mySum = 2+3; +console.log(mySum); +// Write a JavaScript program that runs only when 2 things are true. +const num1 = true; +const num2 = true; + +if(num1&&num2){ + console.log('both are true'); +}; +// Write a JavaScript program that runs when 1 of 2 things are true. +const num3 = true; +const num4 = false; + +if(num3||num4){ + console.log('one is true'); +}; +// Write a JavaScript program that runs when both things are not true. +const num5 = false; +const num6 = false; + +if(!num5&&!num6){ + console.log('both are false'); +}; \ No newline at end of file diff --git a/01week/index.html b/01week/index.html new file mode 100644 index 000000000..9c851057f --- /dev/null +++ b/01week/index.html @@ -0,0 +1,11 @@ + + + + + Document + + + + + + \ No newline at end of file From 57e6abd4299516ad3fa5eca21b845aa4d968c26f Mon Sep 17 00:00:00 2001 From: evantwidwell Date: Tue, 31 Mar 2020 11:20:27 -0500 Subject: [PATCH 3/4] homework week 1 day 1 --- 01week/datatypes.js | 9 +++++++++ 01week/index.html | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index 9d6af6f1a..28da2a30e 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -5,6 +5,12 @@ let now = new Date(); console.log("the current date and time is: " + now); + +let myButton = document.getElementById("theTime"); +myButton.addEventListener('click', function(){ + myButton.innerText = now.toString(); +}); + // Write a JavaScript program to convert a number to a string. const theNumber = 5; @@ -43,6 +49,9 @@ console.log(typeof myString); // Write a JavaScript program that adds 2 numbers together. const mySum = 2+3; console.log(mySum); + +let displaySum = document.getElementById("Sum"); +displaySum.innerText = mySum.toString(); // Write a JavaScript program that runs only when 2 things are true. const num1 = true; const num2 = true; diff --git a/01week/index.html b/01week/index.html index 9c851057f..cfa8eb459 100644 --- a/01week/index.html +++ b/01week/index.html @@ -5,7 +5,13 @@ Document - + +

The current date and time is +

+
+

The sum of 2 and 3 is: +

\ No newline at end of file From ba6e4e6214813b3f65be01fd5a9c487862062118 Mon Sep 17 00:00:00 2001 From: evantwidwell Date: Tue, 31 Mar 2020 19:20:34 -0500 Subject: [PATCH 4/4] changes to datatypes --- 01week/datatypes.js | 1 - 1 file changed, 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index 28da2a30e..8466aa2f0 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -5,7 +5,6 @@ let now = new Date(); console.log("the current date and time is: " + now); - let myButton = document.getElementById("theTime"); myButton.addEventListener('click', function(){ myButton.innerText = now.toString();