From a92343a177cba177b525e3883fc953c656e520cd Mon Sep 17 00:00:00 2001 From: uhuru3 Date: Thu, 11 Oct 2018 19:32:39 -0700 Subject: [PATCH 1/2] initial commit --- 01week/datatypes.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/01week/datatypes.js b/01week/datatypes.js index e69de29bb..c9f7db2e2 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -0,0 +1,27 @@ +'use strict'; +console.log('here'); +//Write a JavaScript program that adds 2 numbers together. +const sumOfTwoNumbers=(num1, num2)=>{ + return num1+num2 + +}; + +sumOfTwoNumbers(3,2); + +// Write a JavaScript program that only runs when 2 things are true. + +// function that recieves two items, if those two things are true. +// methods: function, 2 arguments, if/ then statement + +const evaluatesToTrue=(arg1, arg2)=> { + if(arg1 && arg2){ + return 'both are true' + }else{ + return 'nope' + } +}; + +evaluatesToTrue(4, 6); +evaluatesToTrue(null, 6); + +const oneArgumentIsTrue=(arg1, arg2)=> arg1 || arg2; \ No newline at end of file From d6101924ed74ee555abdeb65f6494dcf49cdddea Mon Sep 17 00:00:00 2001 From: uhuru3 Date: Sun, 28 Oct 2018 14:21:32 -0700 Subject: [PATCH 2/2] Found messed up branch changes --- 01week/datatypes.js | 70 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index c9f7db2e2..6d466f615 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -24,4 +24,72 @@ const evaluatesToTrue=(arg1, arg2)=> { evaluatesToTrue(4, 6); evaluatesToTrue(null, 6); -const oneArgumentIsTrue=(arg1, arg2)=> arg1 || arg2; \ No newline at end of file + +// pasted code + +const oneArgumentIsTrue=(arg1, arg2)=> arg1 || arg2; + + + +// 1. Write a JavaScript program to display the current day and time. +const today = new Date(); +const day = today.getDay(); + +// 2. Write a JavaScript program to convert a number to a string. +const num = 15; +const n = num.toString(); + +// 3. Write a JavaScript program to convert a string to the number. +const stingToNum = '10'; +const s = parseInt(); + +// 4. Write a JavaScript program that takes in different datatypes and prints out whether they are a: + // Boolean + console.log(typeof true); +// expected output: "boolean" + + // Null + const person = {firstName: 'Lawerence' , lastName: 'Williams'}; + person = null; + + // Undefined + console.log(typeof variableNotDeclared); +// expected output: "undefined"; + + // Number + console.log(typeof 42); +// expected output: "number" + + // NaN + isNaN(); + + // String + console.log(typeof 'dance'); +// expected output: "string" + +// 5. Write a JavaScript program that adds 2 numbers together. +const sumOfNums= (arg1, arg2)=>{ + return arg1 + arg2 + }; + +// 6. Write a JavaScript program that runs only when 2 things are true. +const sumOfNums= (arg1, arg2)=>{ + if (typeOf arg1 === typeOf 'number' && typeof 'number'){ + return arg1 + arg2 + } + }; + +// 7. Write a JavaScript program that runs when 1 of 2 things are true. + const bothTrue =(arg1, arg2)=>{ + if(arg1 && arg2){ + return 'true' + } + }; + +// 8. Write a JavaScript program that runs when both things are not true. + const checkStrings=(a,b,c)=>{ + if(typeof a === 'string' && typeof b === 'string' && typeof c === 'string'){ + return 'awesome' + } + }; + checkStrings('hello', '7', 'no') \ No newline at end of file