Ad

function find_max(arr){
maxNum = arr[0];
arr.forEach((ele)=>{
if(ele > maxNum){
maxNum = ele;
}
})
return maxNum;
}

Code
Diff
  • function find_max(arr){
    	maxNum = arr[0];
    	arr.forEach((ele)=>{
    		if(ele > maxNum){
    			maxNum = ele;
    		}
    	})
    	return maxNum;
    }
    
    • def find_max(arr):
    • return 0
    • function find_max(arr){
    • maxNum = arr[0];
    • arr.forEach((ele)=>{
    • if(ele > maxNum){
    • maxNum = ele;
    • }
    • })
    • return maxNum;
    • }