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
5 changes: 5 additions & 0 deletions Assignment/Assignment-2/p1.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ Output: Even

function evenOrOdd(num) {
// Your code here
if (num % 2 == 0){
return "Even";
} else {
return "Odd";
}
}
module.exports = evenOrOdd;
1 change: 1 addition & 0 deletions Assignment/Assignment-2/p2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ Output: "tneduts a ma I"

function reverseString(str) {
// Your code here
return str.split("").reverse().join("");
}
module.exports = reverseString;
2 changes: 2 additions & 0 deletions Assignment/Assignment-2/p3.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ Output: ["Short", "Longer", "Longest"]

function sortByLength(arr) {
// Your code here
let sorted = arr.sort((a,b) => a.length - b.length);
return sorted;
}
module.exports = sortByLength;