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
14 changes: 7 additions & 7 deletions src/arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -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
}

/**
Expand All @@ -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
}

/**
Expand All @@ -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 };
15 changes: 12 additions & 3 deletions src/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 };