diff --git a/src/arrays.ts b/src/arrays.ts index d9ada59..e881ac4 100644 --- a/src/arrays.ts +++ b/src/arrays.ts @@ -11,8 +11,8 @@ function isArrayLengthOdd(numbers: number[]): boolean { // Your code here - - return false; // replace false with what you see is fit + + return numbers.length%2 !== 0; // replace false with what you see is fit } /** @@ -29,7 +29,7 @@ function isArrayLengthOdd(numbers: number[]): boolean { function isArrayLengthEven(numbers: number[]): boolean { // Your code here - return false; // replace false with what you see is fit + return numbers.length%2 === 0; // replace false with what you see is fit } /** @@ -42,8 +42,8 @@ function isArrayLengthEven(numbers: number[]): boolean { */ function addLailaToArray(instructors: string[]): string[] { // Your code here - - return []; // replace empty array with what you see is fit + instructors.push("Laila") + return instructors; // replace empty array with what you see is fit } /** @@ -56,8 +56,8 @@ function addLailaToArray(instructors: string[]): string[] { */ function eliminateTeam(teams: string[]): string { // Your code here - - return ""; // replace empty string with what you see is fit + let lastTeamMember = teams.pop() + return lastTeamMember?lastTeamMember:""; // replace empty string with what you see is fit } export { isArrayLengthOdd, isArrayLengthEven, addLailaToArray, eliminateTeam }; diff --git a/src/challenge.ts b/src/challenge.ts index 620530f..05cad85 100644 --- a/src/challenge.ts +++ b/src/challenge.ts @@ -14,7 +14,10 @@ */ function secondHalfOfArrayIfItIsEven(fruits: string[]): string[] { // Your code here - + if(fruits.length%2 === 0) + { + return fruits.slice(fruits.length/2, fruits.length) + } return []; // replace empty array with what you see is fit } @@ -34,8 +37,14 @@ function secondHalfOfArrayIfItIsEven(fruits: string[]): string[] { */ function youGottaCalmDown(shout: string): string { // Your code here - - return ""; // replace the empty string with what you see is fit + let shouting = shout.split('!') + if(shouting.length === 1 ) + { + return shout + } + // shouting = shouting.concat(shouting[0], shouting[1]); + + return shouting[0]+'!'; // replace the empty string with what you see is fit } export { secondHalfOfArrayIfItIsEven, youGottaCalmDown };