Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still working on it #324

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
124 changes: 102 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ Do the following:
2. Console log true if age is 18 or higher

HINT: no function required
*/
*/

const votingAge = 18;

if (votingAge >= 18){
console.log('task 1 a:',true);
}else{
console.log('task 1 a:',false);
}







Expand All @@ -33,6 +45,16 @@ Do the following:

HINT: no function required
*/
let instrument = 'electric guitar';
let sound = 'loud';

if(sound === 'quiet'){
instrument = 'acoustic guitar';
}else{
instrument = 'electric guitar';
}
console.log('task 1b', instrument);




Expand All @@ -48,6 +70,8 @@ Do the following:

HINT: look up the Number method
*/
const year = "1999";
console.log('task 1 c:', Number(year));



Expand All @@ -65,6 +89,8 @@ function multiply(num1, num2){
return num1 * num2;
}

console.log('task 1 d:', multiply(3, 3));



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

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


console.log('task 2', dogYears(39));

/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 3 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

Expand Down Expand Up @@ -129,9 +155,27 @@ NOTE 2: This is a great time to check the tests to see what it expects, versus w
So, on this one test, the weight would be 4 pounds, and the age would be 1 years old. It's expecting your function to return a decimal number of 0.2
*/

function hungryDog(/*add your code here*/){
/*add your code here*/
function hungryDog(weight, age){
if(age >= 1 && weight <=5){
return weight * 0.05;
}else if(age >= 1 && weight >= 6 && weight <= 10){
return weight * 0.04;
}else if(age >= 1 && weight >= 11 && weight <= 15){
return weight * 0.03;
}else if( age >= 1 && weight > 15){
return weight * 0.02;
}else if(age < 1 && age >= 0.583){
return weight * 0.04;
}else if (age < 0.583 && age >= 0.333){
return weight * 0.05;
}else if(age < 0.333){
return weight * 0.10;
}else{
return 'please try again';
}
}
console.log('task 3', hungryDog(15, 1));




Expand All @@ -155,10 +199,33 @@ Use the game function below to do the following:

RULES OF THE GAME: Scissors beats Paper | Paper beats Rock | Rock beats Scissors | Or there's a tie
*/
let computer = Math.random();

if(computer <= 0.34){
computer = 'rock';
}else if(computer <= 0.67){
computer = 'paper';
}else if(computer > 0.67){
computer = 'sissors';
}

function game(user, computer){
/*add your code here*/
}
if(user === computer){
return `it's a tie`;
}else if(user === `rock` && computer === `scissors`){
return `you win!`;
}else if(user === `paper` && computer === `rock`){
return `you win!`;
}else if(user === `scissors` && computer === `paper`){
return `you win!`;
}else{
return `you lose!`;
}

}
console.log('task 4', game('paper', computer));





Expand All @@ -173,11 +240,11 @@ 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(km){
return km * 0.621371;
}


console.log('task 5a', miles(2));

//Task 5b - Centimeters to Feet
/*
Expand All @@ -187,11 +254,11 @@ 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(cm){
return cm / 30.48;
}


console.log('task 5b', feet(3));

/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 6 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

Expand All @@ -207,10 +274,13 @@ Using the annoyingSong function below do the following:
4. Each time the annoyingSong is run from this loop, it should console.log the string that was returned.
*/

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

function annoyingSong(number){
for(let i = number; i > 0; i --){
return `${i} bottles of soda on the wall, ${i} bottles of soda, take one down pass it around ${i -1} bottles of soda on the wall`;
}
}
console.log('task 6', annoyingSong(5));
console.log('task 6', annoyingSong(3));

/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 7 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

Expand All @@ -227,10 +297,20 @@ Using the grade function below do the following:
below should return 'you got an F'
*/

function grade(/*Your Code here */){
/*Your Code here */
}

function grade(number){
if(number >= 90){
return `you got an A`;
}else if(number < 90 && number >= 80){
return `you got a B`;
}else if(number < 80 && number >= 70){
return `you got a C`;
}else if(number < 70 && number>= 60){
return `you got a D`;
}else if(number < 60){
return `you got an F`;
}
}
console.log(`task 7`, grade(55));


/*💪💪💪💪💪💪💪💪💪💪 Stretch 💪💪💪💪💪💪💪💪💪💪*/
Expand Down
Loading