Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript average of arguments

const average = (...args) => args.reduce((a, b) => a + b) / args.length;

// Example
average(1, 2, 3, 4);    // 2.5
Comment

JavaScript average function

const arr = [5,10,15,20,25];
        arr.reduce(function(x,y){
            sum = x+y;
            mean = sum/arr.length;
            return sum;
        },
        0);
         console.log(mean);//15
Comment

PREVIOUS NEXT
Code Example
Javascript :: js enums class 
Javascript :: jquery window offset top 
Javascript :: disable submit button if input is empty 
Javascript :: how to stop browser back js history.pushState 
Javascript :: random rgba color javascript except black 
Javascript :: disable a button in javascript 
Javascript :: While loop factorial function in javascript 
Javascript :: react js console log not working 
Javascript :: for range python javascript 
Javascript :: substring javscript 
Javascript :: how to use if in setstate 
Javascript :: axios set body 
Javascript :: typeorm get data from a table by array of id 
Javascript :: mongodb add new field 
Javascript :: how to close tab by javascript 
Javascript :: javascript rupiah currency format 
Javascript :: catch error message js 
Javascript :: lwc quick action close 
Javascript :: js setinterval 
Javascript :: axios.defaults.withCredentials = true 
Javascript :: how to link a photo in expo react native 
Javascript :: javascript getelementbyid 
Javascript :: window.location 
Javascript :: how to remove first child in javascript 
Javascript :: contenteditable paste plain text 
Javascript :: javascript atualizar pagina 
Javascript :: javascript iterate through a map 
Javascript :: insert into array js 
Javascript :: javascript bubble sort 
Javascript :: javascript pluck from array of objects 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =