Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions 01week/Conditionals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
console.log("start program");

//write a fuction that takes in 3 variable
//and checks if they are all strings


function areStrings(thing1, thing2, thing3){
// code to excute my logic
console.log("thing1 =", thing1);
console.log("thing2 =", thing2);
console.log("thing3 =", thing3);

let type1 = typeof thing1;
let type2 = typeof thing2;
let type3 = typeof thing3;

//if all 3 type are strings then print out "They are all strings"
if(
type1 === "string" &&
type2 === "string" &&
type3 === "string"
){
console.log("they are not all string");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should say they are all strings

}
else{
console.log("they are not all string");
}
}

areStrings( 4, "Lance", null)
console.log("end program");


function isPassing(grade){
if(grade >= 70){
return true;
}
else{
return false;
}
}
21 changes: 21 additions & 0 deletions 01week/datatypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

//Write a JavaScript program to display the current day and time.
let now = Date();
console.log("the current date and time", now);

//Write a JavaScript program to convert a number to a string.
const theNumber = 5;
const theString = theNumber.toString();

console.log("The type of theSring varaible is", (typeof theString))
console.log("The type of theNumber varaible is", (typeof theNumber))
console.log("The syring is");
console.log("The number is", theNumber);


//Write a JavaScript program to convert a string to the number.
const theOtherString = "11";
const theOtherNumber = (theOtherString, 10);
console.log("The otherString type is", (typeof theOtherString));
console.log("The otherNumber type is", (typeof theOtherNumber));
19 changes: 18 additions & 1 deletion 01week/rockPaperScissors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,29 @@ const rl = readline.createInterface({

// the function that will be called by the unit test below
const rockPaperScissors = (hand1, hand2) => {

hand1 = hand1.toLowerCase()
hand2 = hand2.toLowerCase()
console.log(hand1)
// Write code here
// Use the unit test to see what is expected
if (hand1 === hand2){
return "It's a tie!";
}

else if (hand1 === "rock" && hand2 === "paper"){
if (hand1 === "paper" && hand2 === "scissors");
else (hand1 === "scissors" && hand2 === "rock");
return "Hand two wins!";
}

else if (hand1 === "paper" && hand2 === "rock"){
if (hand1 === "rock" && hand2 === "scissors");
else (hand1 === "scissors" && hand2 === "paper");
return "Hand one wins!";
};
}


// the first function called in the program to get an input from the user
// to run the function use the command: node main.js
// to close it ctrl + C
Expand Down