Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

sum of positive javascript

function positiveSum(arr) {
  return arr.reduce((acc, curr) => acc + (curr > 0 ? curr : 0))
}

positiveSum([1,2,-3,4]) // 7
Comment

PREVIOUS NEXT
Code Example
Javascript :: classname toggle js 
Javascript :: redirect window 
Javascript :: express body-parser deprecated 
Javascript :: datatable loading 
Javascript :: jquery left arrow key press 
Javascript :: jquery cast to string 
Javascript :: send a message to a specific channel discord.js 
Javascript :: min max and average finder in js array 
Javascript :: js check for class in classList 
Javascript :: get text in select jquery 
Javascript :: js round to nearest thousand 
Javascript :: tabe close alert in js 
Javascript :: change onclick attribute javascript 
Javascript :: javascript degree to radians 
Javascript :: document queryselector click event 
Javascript :: get current scroll height javascript 
Javascript :: vue + change router link active class 
Javascript :: javascript detect video end 
Javascript :: get method 
Javascript :: js paste event 
Javascript :: javascript current time 
Javascript :: jquery on 2 events 
Javascript :: vetur Property has no initializer and is not definitely assigned in 
Javascript :: document not intialized react js 
Javascript :: convert responsetext to json python 
Javascript :: base64 to string and string to base64 javascript decode 
Javascript :: javascript date 3 months ago 
Javascript :: autoplay video in angular 
Javascript :: nuxt dev server does not work on local network 
Javascript :: codewars js Spinning Rings 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =