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
72 changes: 72 additions & 0 deletions 01week/datatypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
`use strict`

//returns current date and time
//make a today var, which is assigned a new date instance
//make new var to store the today var and toDateString method
//use var today with toTimeString method

var today = new Date();
var readable = today.toString();

//create a var to convert.
//input a number into var convert
//use convert and toString() method to make the number a string

const num = 13
const n = console.log(num.toString)

//set var to a string
//use parseInt() method

const str = `15 Years`
const int = console.log(parseInt(str))

//tells what type of datatype your input is
//create a variable of any main datatype
//use the typeOf method on the variable

const dataType = `words words words`
const result = console.log(typeof(dataType))

//Create two var that can be a string or number, the string must contain a number though
//Create a function with the two var
//Inside the function, add the two var together
//Use parseInt() to take the number out of the string

const numOne = `13`
const numTwo = `17`

function add() {
return parseInt(numOne) + parseInt(numTwo)
}

add();

//write a function that returns a true if two var are truthy
//if both var are true, show "nope"
//if both var are false, also show "nope"
// if one is false and one is true, show "yep!"

function truest(thingOne, thingTwo) {
if ((thingOne === true && thingTwo === true) || (thingOne === false && thingTwo === false)){
return `nope`
} else {
return 'yep!'
}
};

truest();

//write a function that only runs when both var are false
//if both var are false, show a confirmation message

const dumb = dfs
const dumber = aadsadfdfds

function womp() {
if (dumb === false && dumber === false) {
return `yes, they're both false`
}
};

womp()
20 changes: 16 additions & 4 deletions 01week/rockPaperScissors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ const rl = readline.createInterface({


function rockPaperScissors(hand1, hand2) {

// Write code here

}
// check for a tie, if it is a tie, return tie, if not check for win
// rock beats scissors, scissors beats paper, paper beats rock
//to find who won, compare hand1 to hand2
const handOne = 'Hand one wins!'
const handTwo = 'Hand two wins!'

if(hand1 === hand2) {
return "It's a tie!";
} else if (hand1 === 'rock'){
return hand2 === 'paper' ? handTwo : handOne;
} else if (hand1 === 'paper') {
return hand2 === 'scissors' ? handTwo : handOne;
} else if (hand1 === 'scissors') {
return hand2 === 'rock' ? handTwo : handOne;
}
};

function getPrompt() {
rl.question('hand1: ', (answer1) => {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<title></title>
</head>
<body>
<h1>Hello World!</h1>
<h1>Hello Eric, how are you!</h1>
</body>
</html>