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
8 changes: 4 additions & 4 deletions basicMath/MathUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ class MathUtilities {


add(baseValue, valueToAdd){
return -1;
return baseValue + valueToAdd;
}

subtract(baseValue, valueToAdd){
return -1;
return baseValue - valueToAdd;
}

divide(baseValue, valueToAdd){
return -1;
return baseValue / valueToAdd;
}

multiply(baseValue, valueToAdd){
return -1;
return baseValue * valueToAdd;
}
}

Expand Down
2 changes: 1 addition & 1 deletion basicMath/MathUtilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test("Test 2 Integer Division", () => {
let addedValue = 1;

// When
let expected = 127;
let expected = 2;
let actual = math.divide(baseValue, addedValue);
//Then
expect(actual).toEqual(expected);
Expand Down
51 changes: 40 additions & 11 deletions strangerStrings/StrangerStrings.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,64 @@
class StrangerStrings {

getHelloWorld(){
return null;
let helloWorld = "Hello World"
return helloWorld;
}

concatenation(firstSegment, secondSegment){
return null;
return firstSegment + secondSegment;
}

getPrefix(input){
return null;

/* let FirstLetter = input[0]
let SecondLetter = input [1]
let ThirdLetter = input [2]
return FirstLetter + SecondLetter + ThirdLetter; */
return input.substr(0,3);
}

getSuffix(input){
return null;

let FourthLetter = input[input.length - 3];
let FifthLetter = input[input.length - 2];
let lastLetter = input[input.length - 1];
return FourthLetter + FifthLetter + lastLetter;

}

getMiddleCharacter(input){
return null;
let inputLength = input.length;
let middle = Math.floor(inputLength/2);
if (inputLength % 2 == 0){
// if even
return input[middle - 1] + input[middle];
} else {
//if odd
return input[middle];
}
}

getFirstWord(input){
return null;
getFirstWord(inputValue){
let x = inputValue.split(" ");
let firstWord = x[0];
return firstWord;
}

getSecondWord(spaceDelimnatedInput){
return null;
getSecondWord(inputValue){
let x = inputValue.split(" ");
let secondWord = x[1];
return secondWord;
}

reverse(input){
return null;
reverse(inputValue){
let x = inputValue.split("");
// x = [w,u,t,a,n,g,c,l,a,n]
let rev = x.reverse();
// rev= n,a,l,c,g,n,a,t,u,w
let together = rev.join("");
// join = nalcgnatuw
return together;
}
}

Expand Down
6 changes: 3 additions & 3 deletions strangerStrings/StrangerStrings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ test("return the last 3 characters of `input`", () => {
});


test("return the middle character of `inputValue`", () => {
test("return the middle character of `input`", () => {
// Given
let strangerStrings = new StrangerStrings();
let inputValue = 'MethodMan';
let input = 'MethodMan';

let expected = "o";

Expand All @@ -76,7 +76,7 @@ test("return the first sequence of characters", () => {
// Given
let strangerStrings = new StrangerStrings();
let inputValue = 'Wutang Clan';

// inputValue=[Wutang, Clan]
let expected = "Wutang";


Expand Down