generate functionThu, 01 Dec 2022
find max array
function findMax(arr) { if (arr.length === 0) return 0; var max = arr[0]; for (var i = 0; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } findMax([1, 2, 3]);
Javascript
Generate More