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
73 changes: 51 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Do the following:

HINT: no function required
*/
// let a = 1;
// let b = 2;


// if ()



Expand All @@ -46,7 +48,8 @@ Do the following:
HINT: look up the Number method
*/


let num = '1999';
returnNumber(num);


/*
Expand All @@ -58,10 +61,10 @@ 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 * b)
}

console.log(multiply(3,4))


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 2 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand All @@ -74,10 +77,10 @@ Do the following:
3. Return the newly calculated age
*/

function dogYears(/*add your code here*/){
/*add your code here*/
function dogYears(myAge){
return (myAge * 7);
}

console.log(dogYears(25));


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 3 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand Down Expand Up @@ -107,10 +110,26 @@ 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(weight,age ){
if (age >= 1){
if (weight <= 5){
return (weight * .05);
} else if (weight > 5 && weight <= 10){
return (weight * .04);
} else if (weight > 10 && weight <=15){
return (weight * .03);
} else if (weight > 15){
return (weight *.02);
}
} else if (age >= .1666 && age < .333){
return (weight * .1)
} else if (age >= .3334 && age < .583){
return (weight * .05);
} else if (age >= .584 && age < 1){
return (weight * .04);
}
}

console.log(hungryDog(15,1));


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 4 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand All @@ -127,7 +146,7 @@ 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*/){
function game(choice,){
/*add your code here*/
}

Expand All @@ -144,10 +163,10 @@ Using the miles function below do the following:
3. Return the number of miles
*/

function miles(/*add your code here*/){
/*add your code here*/
function miles(numKM){
return (numKM * .621371)
}

console.log(miles(5))


//Task 5b - Feet to CM
Expand All @@ -158,10 +177,10 @@ Using the feet function below do the following:
3. Return number of feet
*/

function feet(/*add your code here*/){
/*add your code here*/
function feet(numCM){
return (numCM / 30.48 )
}

console.log(feet(100))


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 6 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
Expand All @@ -173,7 +192,7 @@ Using the annoyingSong function below do the following:
2. At each iteration, it should return this string:
"(number) bottles of soda on the wall, (number) bottles of soda, take one down pass it around (number left over) bottles of soda on the wall"
*/

dsf
function annoyingSong(/*add your code here*/){
/*add your code here*/
}
Expand All @@ -194,11 +213,21 @@ Using the grade function below do the following:
below 60 = F
*/

function grade(/*add your code here*/){
/*add your code here*/
function grade(score){
if (score >= 90){
return 'A'
} else if (score >= 80){
return 'you got a B'
} else if (score >= 70){
return 'C'
} else if (score >= 60){
return 'D'
} else {
return 'F'
}
}


console.log(grade(75))



Expand Down