From 793309858824ca231cde179da44fbdc2e8db525b Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Sat, 30 May 2020 11:57:39 -0500 Subject: [PATCH 1/2] updates --- 01week/datatypes.js | 61 ++++++++++++++++++++++++++++++++++++++++++++ 01week/helloworld.js | 9 ++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index e69de29bb..93b16a66b 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -0,0 +1,61 @@ +// 1. Write a JavaScript program to display the current day and time. +let rightNow = new Date(); +console.log('Today is', rightNow); +// 2. Write a JavaScript program to convert a number to a string. +let num = 4; +console.log(num.toString()); +// 3. Write a JavaScript program to convert a string to the number. +let str = '4'; +let otherStr = parseInt(str); +console.log(otherStr); +// 4. Write a JavaScript program that takes in different datatypes and prints out whether they are a: +// p0. Boolean +let boolean = true; +console.log(typeof boolean); +// p1. Null +let nully; +console.log(typeof nully); +// p2. Undefined +let undies; +console.log(typeof undies); +// p3. Number +console.log("this is part two using this varible again",typeof str) +// p4. NaN + + +// p5. String +let whatsThis = "Christopher Trevino"; +console.log(typeof whatsThis); + +// 6. Write a JavaScript program that adds 2 numbers together. +let x = 5; +let y = 15; +let total = x + y; +console.log(total); +// 7. Write a JavaScript program that runs only when 2 things are true. +function twoThingTrue() { + if (x === 5 && y === 15) { + return true; + + } + +} +console.log(twoThingTrue()) + +// 8. Write a JavaScript program that runs when 1 of 2 things are true. +function oneOfTwo() { + if (x === 5 || y === 10) { + return true; + } else { + return "If this logs i came out as false" + } + +} +console.log(oneOfTwo()) +// 9. Write a JavaScript program that runs when both things are not true. +function bothFalse(){ + if (x === 10 || y === 5) { + return false + } +} +console.log(bothFalse()); \ No newline at end of file diff --git a/01week/helloworld.js b/01week/helloworld.js index 8274abb6f..a2c6d51ad 100644 --- a/01week/helloworld.js +++ b/01week/helloworld.js @@ -1,3 +1,10 @@ "use strict" - console.log("Hello World!"); \ No newline at end of file + console.log("Hello World!"); + + let x = 7; + let y = 8; + + let z = x+y; + + console.log("The value of Z is ", z); \ No newline at end of file From ee86714b85ae5dd185692b931887ec98bd87b0f8 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Mon, 1 Jun 2020 18:13:38 -0500 Subject: [PATCH 2/2] DONE --- 01week/datatypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index 93b16a66b..1ed2ebe2f 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -47,7 +47,7 @@ function oneOfTwo() { if (x === 5 || y === 10) { return true; } else { - return "If this logs i came out as false" + return "If this logs both came out as false" } }