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

Arius 8-0-skill-sharpening-project #246

Open
wants to merge 1 commit 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
28 changes: 17 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 41 additions & 10 deletions src/01-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* alwaysTrue();
* //> true
*/
function alwaysTrue() {}
function alwaysTrue() {
return (true)// logs boolean true
}

/**
* greet()
Expand All @@ -24,7 +26,9 @@ function alwaysTrue() {}
* greet("Ian");
* //> "Hello, Ian."
*/
function greet() {}
function greet(name) {
return `Hello, ${name}.`//return the string Hello, and the string variable name using ``string interpolation
}

/**
* add()
Expand All @@ -39,7 +43,10 @@ function greet() {}
* add(10, 20);
* //> 30
*/
function add() {}
function add(a , b) {
number = (a + b)//intiated variable assigned to the sum of number a & number b
return(number)// return the number variable
}

/**
* multiply()
Expand All @@ -54,7 +61,10 @@ function add() {}
* multiply(2, 5);
* //> 10
*/
function multiply() {}
function multiply( a, b) {
number = a*b//intiated variable assigned to the product of number a & number b
return(number)// return the number variable
}

/**
* average()
Expand All @@ -74,7 +84,10 @@ function multiply() {}
* average(10, 6);
* //> 8 // 10 + 6 = 16; 16/2 = 8;
*/
function average() {}
function average(a , b) {
number = ((a+b)/2)//intiated variable assigned to the sum of number a & number b divided by 2
return(number)//return the number variable
}

/**
* averageThree()
Expand All @@ -93,7 +106,10 @@ function average() {}
* averageThree(10, 11, 19);
* //> 10 // 10 + 11 + 19 = 30; 30 / 3 = 10;
*/
function averageThree() {}
function averageThree(a,b,c) {
number =((a + b + c)/3)//intiated variable assigned to the sum of number a,number b, & number c divided by 3
return(number)// return the number variable
}

/**
* compareTypes()
Expand All @@ -112,7 +128,12 @@ function averageThree() {}
* compareTypes("left", 10);
* //> false
*/
function compareTypes() {}
function compareTypes(a,b) {
if (typeof(a) === typeof(b)){//if the data type of a strictly equal the data type of b
return(true)//return the boolean true
}else//otherwise
return(false)//return the boolean false
}

/**
* flipSign()
Expand All @@ -131,7 +152,10 @@ function compareTypes() {}
* flipSign(50);
* //> -50
*/
function flipSign() {}
function flipSign(a) {
number = (a*(-1))//intiate variable number assigned to the product of variable a & -1
return(number)//returns number variable
}

/**
* joinStringsWithSpaces()
Expand All @@ -151,7 +175,11 @@ function flipSign() {}
* joinStringsWithSpaces("left", "right", "up", "down", "away");
* //> "left right up down away"
*/
function joinStringsWithSpaces() {}
function joinStringsWithSpaces(a, b, c, d, e) {
return a+" "+b+ " "+c+" "+d+" "+e
//`${a} ${b} ${c} ${d} ${e}`
//easier solution
}

/**
* getFirstAndLastCharacter()
Expand All @@ -168,7 +196,10 @@ function joinStringsWithSpaces() {}
* getFirstAndLastCharacter("upwards");
* //> "us"
*/
function getFirstAndLastCharacter() {}
function getFirstAndLastCharacter(a) {
return((a.charAt(0)+(a.charAt(a.length - 1))))
//return character at index 0 of string variable a plus the character at the last index of the string variable a
}

// Do not change the code below.
module.exports = {
Expand Down
52 changes: 42 additions & 10 deletions src/02-data-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* getLengthOfString("down");
* //> 4
*/
function getLengthOfString(str) {}
function getLengthOfString(str) {
return str.length
}

/**
* convertToNumber()
Expand All @@ -22,7 +24,9 @@ function getLengthOfString(str) {}
* convertToNumber("111");
* //> 111
*/
function convertToNumber(val) {}
function convertToNumber(val) {
return ~~val
}

/**
* convertToString()
Expand All @@ -36,7 +40,9 @@ function convertToNumber(val) {}
* convertToString(99);
* //> "99"
*/
function convertToString(val) {}
function convertToString(val) {
return(val.toString())
}

/**
* convertToShoutingText()
Expand All @@ -49,7 +55,9 @@ function convertToString(val) {}
* convertToShoutingText("Hello There");
* //> "HELLO THERE"
*/
function convertToShoutingText(text) {}
function convertToShoutingText(text) {
return text.toUpperCase(text)
}

/**
* convertToWhisperText()
Expand All @@ -62,7 +70,9 @@ function convertToShoutingText(text) {}
* convertToWhisperText("Hello There");
* //> "hello there"
*/
function convertToWhisperText(text) {}
function convertToWhisperText(text) {
return text.toLowerCase(text)
}

/**
* checkIfCharacterIsInString()
Expand All @@ -79,7 +89,9 @@ function convertToWhisperText(text) {}
* checkIfCharacterIsInString("hello there", "a");
* //> false
*/
function checkIfCharacterIsInString(text, character) {}
function checkIfCharacterIsInString(text, character) {
return text.includes(character)
}

/**
* isEven()
Expand All @@ -95,7 +107,12 @@ function checkIfCharacterIsInString(text, character) {}
* isEven(11);
* //> false
*/
function isEven(num) {}
function isEven(num) {
if ((num % 2) === 0){
return true
} else
return false
}

/**
* isOdd()
Expand All @@ -111,7 +128,12 @@ function isEven(num) {}
* isOdd(11);
* //> true
*/
function isOdd(num) {}
function isOdd(num) {
if ((num % 2) !== 0){
return true
} else
return false
}

/**
* isTruthy()
Expand All @@ -127,7 +149,12 @@ function isOdd(num) {}
* isTruthy(null);
* //> false
*/
function isTruthy(val) {}
function isTruthy(val) {
if (!!val){
return true
}else
return false
}

/**
* isFalsy()
Expand All @@ -143,7 +170,12 @@ function isTruthy(val) {}
* isFalsy(" ");
* //> false
*/
function isFalsy(val) {}
function isFalsy(val) {
if (!(!!val)){
return true
}else
return false
}

// Do not change the code below.
module.exports = {
Expand Down
Loading