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
31 changes: 26 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
/************************************************************** Task 1: Warm-up! **************************************************************/
//Task a: declare a variable called votingAge, console log true if age > 18 (no function required)
let votingAge = 18;

if(votingAge > 18) {
console.log(true);
} else {
console.log(false);
}




//Task b: declare a variable and then use a conditional to change the value of that variable based on the value assigned to a second variable (no function required)



//Task b: declare a variable and then use a conditional to change the value of that variable based on the value assigned to a second variable (no function required)
let numOne = 5;
let numTwo = 10;

if(numTwo < numOne) {
numOne = numOne - 4
console.log('numOne is bigger' , numOne)
} else {
console.log('numOne is smaller' , numOne)
}

//Task c: Convert string ("1999") to integer (1999) (no function required) // hint look up the Number method


console.log(parseInt('23497124"))



//Task d: Write a function to multiply a*b

function multiply(a,b)
{ console.log(a*b)

}

multiply(5,2)



Expand All @@ -28,8 +46,11 @@
//write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years


function dogYears(age){
return age * 7
}


console.log(dogYears(42))

/************************************************************** Task 3 **************************************************************/
//Dog feeder
Expand Down