Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Find the maximum number in a jagged array of numbers

function getMax(a){
  return Math.max(...a.map(e => Array.isArray(e) ? getMax(e) : e));
}

var ar = [2,4,10,[12,4,[100,99],4],[3,2,99],0]; 

 console.log(getMax(ar));
Comment

PREVIOUS NEXT
Code Example
Javascript :: moment get iso week number 
Javascript :: change image src using jquery 
Javascript :: comparing two arrays in javascript returning differences 
Javascript :: how to send a request to a web server javascript 
Javascript :: adb reverse USB debugging 
Javascript :: javascript regex reference 
Javascript :: find by array of ids mongoose 
Javascript :: how to pip install jsonlines 
Javascript :: empty function after it is run javascript 
Javascript :: install vue by CDN 
Javascript :: website design html css javascript 
Javascript :: js is undefined or null 
Javascript :: how to get the size of the window in javascript 
Javascript :: javascript .foreach 
Javascript :: how to set the development mode in webpack 
Javascript :: Mars Exploration problem in js 
Javascript :: check if number is decimal or integer js 
Javascript :: uppercase in javascript 
Javascript :: discord chatbot 
Javascript :: validationResult is not defined 
Javascript :: mapgetters with parameter 
Javascript :: javascript Sum of a sequence 
Javascript :: leaflet circle get bounds 
Javascript :: array shuffle 
Javascript :: for of loop in es6 
Javascript :: js typeof number 
Javascript :: Node Sass version 7.0.0 is incompatible with ^4.0.0 
Javascript :: recursion in javascript 
Javascript :: regex must match exactly 
Javascript :: js dictionary to extract the same key bvalues 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =