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 />

<br />

JavaScript Math random() Method<br />

<br />

<br />

<br />

var value = Math.random( );<br />

document.write("First Test Value : " + value );<br />

var value = Math.random( );<br />

document.write("Second Test Value : " + value );<br />

var value = Math.random( );<br />

document.write("Third Test Value : " + value );<br />

var value = Math.random( );<br />

document.write("Fourth Test Value : " + value );<br />

<br />

<br />

<br />

Output<br />

First Test Value : 0.4093269258737564<br />

Second Test Value : 0.023646741174161434<br />

Third Test Value : 0.2672571325674653<br />

Fourth Test Value : 0.38755513448268175<br />

round ( )<br />

This method returns the value of a number rounded to the nearest integer.<br />

Syntax<br />

Its syntax is as follows:<br />

Math.round ( );<br />

301

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

Saved successfully!

Ooh no, something went wrong!