Skip to content
Open
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
78 changes: 70 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ Do the following:

HINT: no function required
*/
let votingAge = 18;
if (votingAge >= 18)
return true;

console.log(true);{
}





Expand All @@ -30,6 +38,11 @@ Do the following:

HINT: no function required
*/
let x = 1;
let y = 2;
if (x === y){
console.log(false)
}



Expand All @@ -45,10 +58,26 @@ Do the following:

HINT: look up the Number method
*/
const number = '1999';
return '1999';

console.log(parseInt(number));











function newFunction() {
{
}
}

/*
Task 1d - Multiply

Expand All @@ -58,10 +87,12 @@ Do the following:
3. Multiply a and b and return the answer
*/

function multiply(/*add your code here*/){
/*add your code here*/
function multiply(/*a, b*/){
return a * beforeAll;
}

console.log(multiply(5,4));



/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 2 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand Down Expand Up @@ -107,9 +138,29 @@ Use the hungryDog function and feeding requirements below to do the following:
NOTE: If done correctly, a weight of 15 lbs and age of 1 year would return 0.44999999999999996
*/

function hungryDog(/*add your code here*/){
/*add your code here*/
function hungryDog(age, weight){
if (age>=1&&weight<=5){
return .05*weight;
}
else if (age>=1&&(weight>=6&&weight<=10)){
return .04*weight;
}
else if (age>=1&&(weight>=11&&weight<=15)){
return .03*weight;
}
else if (age>=1&&weight>15){
return .02*weight;
}
else if (age>=.16&&age<=.33){
return .10*weight;
}
else if (age>=.33&&age<=.58){
return .05*weight;
}
else if (age>=.58&&age<=.99){
return .04*weight;
}
} hungryDog(1, 15);



Expand All @@ -127,10 +178,21 @@ Use the game function below to do the following:
HINT: While you can complete this with only conditionals based on strings, it may help to equate choice to a number when using Math.random()
*/

function game(/*add your code here*/){
/*add your code here*/
}

function game(choice1){
if (choice1 === 'rock' || choice1 === 'paper' || choice1 === 'scissors');
let choice2 = Math.random();
if (choice2 < 0.34) {
choice2 = 'rock'
}
else if (choice2 < 0.67) {
choice2 = 'paper'
}
else {
choice2 = 'scissors'
}
if (choice1 === choice2){
}
}


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 5 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand Down