Greetings
This is another short and sweet posts, basically it involves using the Math. function to do some nifty tricks
Lets say that you want to get a random number between 1 and 10 and you dont know how. Well the answer is quite easy and it involves combining 2 Math. functions. Math.floor() and Math.random().
This function takes a random number between 0 and 1
This function rounds a number down to it’s smaller number, for example. 4.4 would become 4, 4.6 would become 4 as well, -4.1 would become -5 as well as -4.6 would become -5 as well.
Tags: Javascript, Javascript comparing numbers
Categories: Javascript, jQuery
Posted By: Dinulescu Alexandru Adrian
Last Edit: 14 Feb 2010 @ 11:37 PM
Hello
This post is a very straightforward one, basically it involves using javascript to calculate the lowest or highest number from either an array or from some definite variables.
One of the very useful possibilities of this is calculating the height and width of more than 3 columns and equalizing everything to the highest.
To achieve this we can use the Math.max() property and the Math.min() property.
Tags: Javascript, Javascript comparing numbers
Categories: Javascript
Posted By: Dinulescu Alexandru Adrian
Last Edit: 15 Jan 2010 @ 12:23 AM
Recent Comments