Implement a function maxElement that takes an array and returns its maximum element.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
helper.js
export const maxElement = (arr) => {
return 0;
}
solution.js
/**
* Implement a function maxElement that takes an array and return the maximum element
* */
import { maxElement } from './helper.js';
console.log(`The maximum is ${maxElement([1, 2, 3, 4, 5])}`); // 5
console.log(`The maximum is ${maxElement([-1, -4, -5])}`); // -1