JS Tutorial

Function Reference

Method Reference

  • JS String
  • JS Array
  • JavaScript Switch Statement

    JS switch statement is used to execute one statement from multiple conditions.it is similer to IF statements on the same expression

    Get the sum of array values using reduce()

    Sum all the values of an array

    var numbersArary = [2,5,6];
    var newResultValue = numbersArary.reduce(testFunc,0)
    
    function testFunc(accumulator,number) {
      return accumulator + number;
    }
    
    console.log(newResultValue);
    //Output : 13