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
16 changes: 8 additions & 8 deletions basicMath/MathUtilities.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
class MathUtilities {


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

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

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

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

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
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ Then run

```
npm install
```
```

find the total number of indices
divide that by 2
if total number is odd, return 2 middle indices
return that character



find the total number of words by counting the spaces between
if there's a space, break the loop
put characters before space into a variable
return variable
44 changes: 26 additions & 18 deletions strangerStrings/StrangerStrings.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
class StrangerStrings {

getHelloWorld(){
return null;
getHelloWorld() {
return "Hello World";
}

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

getPrefix(input){
return null;
getPrefix(input) {
return input.substring(0, 3);
}

getSuffix(input){
return null;
getSuffix(input) {
return input[input.length - 3] + input[input.length - 2] + input[input.length - 1];
}

getMiddleCharacter(input){
return null;
getMiddleCharacter(input) {
let x = input.length / 2;
if (x % 2 === 0) {
return input[x];
} else {
return input[Math.floor(x)];
}
}

getFirstWord(input){
return null;
getFirstWord(input) {
var firstWord = input.replace(/ .*/, '');
return firstWord;
}

getSecondWord(spaceDelimnatedInput){
return null;

getSecondWord(spaceDelimnatedInput) {
const originalString = spaceDelimnatedInput;
const splitString = originalString.split(" ");
return splitString[1];
}
reverse(input){
return null;

reverse(input) {
return input.split("").reverse().join("");
}
}

Expand Down
4 changes: 2 additions & 2 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 Down