JS switch statement is used to execute one statement from multiple conditions.it is similer to IF statements on the same expression
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