<![CDATA[PunBB Forums — Javascript Math object essentials]]> http://www.xzqu8qr3.top/forums/topic/26124/javascript-math-object-essentials/ Wed, 22 May 2013 21:09:10 +0000 PunBB <![CDATA[Re: Javascript Math object essentials]]> http://www.xzqu8qr3.top/forums/post/149383/#p149383 Ok lol

]]>
Wed, 22 May 2013 21:09:10 +0000 http://www.xzqu8qr3.top/forums/post/149383/#p149383
<![CDATA[Re: Javascript Math object essentials]]> http://www.xzqu8qr3.top/forums/post/149375/#p149375 I know. It's a Programming forum, but there is no sense to post topics like that. Take it easy, homie wink.

]]>
Wed, 22 May 2013 15:49:27 +0000 http://www.xzqu8qr3.top/forums/post/149375/#p149375
<![CDATA[Javascript Math object essentials]]> http://www.xzqu8qr3.top/forums/post/149362/#p149362 Javascript Math object is used to perform tasks like generating random numbers and evaluating constants like Pi.

(function() {
    console.log('Value of Pi: ' + Math.PI);
    console.log('Random number 0-6: ' + Math.floor(Math.random() * 6));
    console.log('Random number 1-6: ' + Math.ceil(Math.random() * 6));
})();

Here too I am using Nodejs and closures.

Note that floor is used to generate random numbers starting from 0; where as ceil is used to generate random numbers starting from 1.

More on Math object available from MDN https://developer.mozilla.org/en-US/doc … jects/Math

]]>
Wed, 22 May 2013 08:00:48 +0000 http://www.xzqu8qr3.top/forums/post/149362/#p149362
金沙国际娱城平台