10.02.2018 Views

js_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Javascript<br />

}<br />

rv = fun.call(null, rv, this[i], i, this);<br />

}<br />

};<br />

return rv;<br />

var total = [0, 1, 2, 3].reduceRight(function(a, b){ return a + b; });<br />

document.write("total is : " + total );<br />

<br />

<br />

<br />

Output<br />

total is : 6<br />

reverse ()<br />

Javascript array reverse() method reverses the element of an array. The first<br />

array element becomes the last and the last becomes the first.<br />

Syntax<br />

Its syntax is as follows:<br />

array.reverse();<br />

Return Value<br />

Returns the reversed single value of the array.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript Array reverse Method<br />

<br />

210

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!