Skip to content
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
70 changes: 70 additions & 0 deletions js/age.js
Original file line number Diff line number Diff line change
@@ -1 +1,71 @@
const userAge = age => {
switch(age){
case 0:
return 'infant';
break;
case 1:
return 'infant';
break;
case 2:
return 'infant';
break;
case 3:
return 'toddler';
break;
case 4:
return 'toddler';
break;
case 5:
return 'toddler';
break;
case 6:
return 'child';
break;
case 7:
return 'child';
break;
case 8:
return 'child';
break;
case 9:
return 'child';
break;
case 10:
return 'child'
break;
case 11:
return 'preteen';
break;
case 12:
return 'preteen';
break;
case 13:
return 'preteen';
break;
case 14:
return 'teen';
break;
case 15:
return 'teen';
break;
case 16:
return 'teen';
break;
case 17:
return 'young adult';
break;
case 18:
return 'young adult';
break;
case 19:
return 'young adult';
break;
case 20:
return 'young adult';
break;
}
}

console.log(userAge(5));


9 changes: 9 additions & 0 deletions js/larger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function largerNumber(x, y){
if( x > y){
console.log(x)
} else{
console.log(y)
}
}

console.log(largerNumber(5, 9));
13 changes: 13 additions & 0 deletions js/pluralizer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let thing = 'cat';
let count = 5;
let plural = `${thing}s`

function pluralizer(thing, count){
if(count > 1){
console.log(plural);
} else{
console.log(thing);
}
}

console.log(count + " " plural);
8 changes: 8 additions & 0 deletions js/tempConvert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const Farenheit = 50;

const Celsius = (Farenheit - 32) * 5/9;

const Kelvin = Math.floor(Celsius - 273.15);

console.log(`${Farenheit} degrees Farenheit is ${Celsius} degrees in Celsius and ${Kelvin} degrees in Kelvin`);

43 changes: 43 additions & 0 deletions js/translator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

const translator = language => {
switch(language){
case 'en':
return 'Hello World';
break;
case 'fr':
return 'Bonjour Le Monde';
break;
case 'sp':
return 'Hola Mundo';
break;

}
}

console.log(translator('en'));

// Comparing Arrays
const arr1 = [1, 'a', 3, 'e', 5, 7, 9, 'i'];
const arr2 = [1, 'a', 3, 'e', 5, 7, 9, 'i'];
const arr3 = [1, 'a', 3, 5, 'e', 7, 10, 'i'];
const arr4 = [0, 2, 4, 6];

// checking to see if the length of the arrays is the same, if it is then it runs the code block inside
if (arr1.length === arr2.length) {

//this for loop does for(start iterating at 0; stop iterating once the array ends; iterate)
for (let i = 0; i < arr1.length; i++) {

//the code block inside checks to see if the variable at arr1[i] is equal to variable at arr2[i] && this iterates over every variable to check to see if the value type is the same in the two arrays.
if (arr1[i] === arr2[i]) {

// if those conditions are met same value, same data type then it will console log the message below to the terminal
console.log("These arrays the same");
break
} else{

// if those conditions are not met the message below will return ot the console
console.log("These arrays are not the same");
}
}
}