Skip to content

Update index.js #337

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
113 changes: 94 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ Task 1a - Voting Age (not auto tested)

Do the following:
1. Create a variable called votingAge and assign it a number value

2. Console log true if age is 18 or higher

HINT: no function required
*/
*/
let votingAge = 18
if (votingAge >= 18) {
console.log ("true")

} else {
console.log ("false")
}




Expand All @@ -33,9 +42,13 @@ Do the following:

HINT: no function required
*/
let firstThing = 2
let secondThing = 4
if (firstThing > secondThing) {
console.log ('true')
}



console.log (firstThing)


/*
Expand All @@ -49,8 +62,9 @@ Do the following:
HINT: look up the Number method
*/



const year = "1999"
const numYear = Number(year)
console.log (numYear)

/*
Task 1d - Multiply
Expand All @@ -64,8 +78,10 @@ Do the following:
function multiply(num1, num2){
return num1 * num2;
}


function multiply(num1, num2) {
return num1 * num2;
}
console.log(numYear)

/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 2 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

Expand All @@ -77,11 +93,14 @@ 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(dogYears(10))


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

Expand Down Expand Up @@ -128,10 +147,28 @@ NOTE 2: This is a great time to check the tests to see what it expects, versus w
Notice the expected and received, expected is what the test is looking for, and received is what was actually returned from this function. You can also see it's passing in two values, the number 4 and the number 1.
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*/){
function hungryDog(weight,age){}
/*add your code here*/
}

if age<=.33{
return weight *.10}
else if (age<=.58){
return weight * .05
} else {
return weight *.04
}
else if (weight <=5){
return weight *.05
} else if (weight <=10) {
return weight *.04

} else if (weight <=15) {
return weight *.03
} else {
return weight *.02
}
}




Expand All @@ -156,28 +193,48 @@ 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 cp =Math.cell(Math.random() * 3)
if (cp ===1) {
cp ='rock';
} else if(cp === 2) {
cp ='paper'
} else {
cp = 'scissors'
}

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

let cp =Math.cell(Math.random() * 3)
if (cp ===1) {
cp ='rock';
} else if(cp === 2) {
cp ='paper'
} else {
cp = 'scissors'
}


/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 5 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/

//Metric Converter
//Task 5a - Kilometers to Miles
/*

Using the miles function below do the following:
1. Receive a number of kilometers
2. Convert the number of kiolmeters received to miles
3. Return the number of miles
*/

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



function miles(kilometers){
return (kilometers * .621371)
}

console.log (miles(3))

//Task 5b - Centimeters to Feet
/*
Expand All @@ -189,9 +246,12 @@ Using the feet function below do the following:

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



}
console.log(feet(156))


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

Expand All @@ -210,7 +270,10 @@ Using the annoyingSong function below do the following:
function annoyingSong(/*add your code here*/){
/*add your code here*/
}
// x = x+1

return `${x} bottles of soda on the wall, ${x} bottles of soda, take one down pass it around ${x-1} bottles of soda on the wall`
// console.log (annoyingSong(i))

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

Expand All @@ -229,9 +292,20 @@ Using the grade function below do the following:

function grade(/*Your Code here */){
/*Your Code here */
function greate(grade){
if (grade >=90) {

return "you got an B"
} else if (grade >= 70) {
return 'you got an C'
} else if (grade >=60) {
return ' you got an D'
} else if (grade >=50) {
return 'you got an F'
}
}


console.log(grade(85))

/*💪💪💪💪💪💪💪💪💪💪 Stretch 💪💪💪💪💪💪💪💪💪💪*/

Expand Down Expand Up @@ -270,3 +344,4 @@ module.exports = {
annoyingSong,
grade
}