Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Find out the sum, minimum and maximum value in javascript

const array  = [5,4,7,8,9,2]; 
Sum in array javascript
array.reduce((a,b) => a+b);

// Output: 35
MAX in array javascript
array.reduce((a,b) => a>b?a:b);
// Output: 9

MIN in array javascript
array.reduce((a,b) => a<b?a:b);
// Output: 2
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to get location javascript 
Javascript :: convert string to float javascript 
Javascript :: how to format datetime in javascript 
Javascript :: cra proxy 
Javascript :: vuex do not mutate vuex store state outside mutation handlers. nuxt 
Javascript :: accepting form data node js 
Javascript :: dynamic regex javascript 
Javascript :: how to get the last two characters of a string in javascript 
Javascript :: node js documentation 
Javascript :: change page javascript 
Javascript :: manually set jquery text box 
Javascript :: check radio button jquery 
Javascript :: json to array javascript 
Javascript :: sort array without mutating js 
Javascript :: Vuejs + Laravel router redirection issue 
Javascript :: javascript insertbefore 
Javascript :: anonymous functions javascript 
Javascript :: yup validation based on another field value 
Javascript :: react cors error 
Javascript :: print array angular 
Javascript :: button disappears after click javascript 
Javascript :: import npm module node.js 
Javascript :: Styling React Using CSS 
Javascript :: how to return argument in javascript 
Javascript :: js html editor 
Javascript :: invariant failed: you should not use <link outside a <router 
Javascript :: math captcha 
Javascript :: get data from google sheets javascript 
Javascript :: angular property value does not exist on type Event 
Javascript :: multi dimensional array javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =