// This one is very simple blog to understand littlebit about MATH function in appcelerator.
// This one is very to easy but i want to share it because today i waste my 3 hour in one simple line code
// I just want to do one simple this like if i get value
3.5 it would be 4 same as,
4.1 it would be 4 same as,
4.9 it would be 5 same as.
It means simple ROUND .
But i didnt think about MATH function at that time . I just try it my own way that one is successful but here one simple mathod ROUND in MATH with the use of this function i easily get may goal.
Example :
There are lots of other part method is available in MATH .
Like
1 ) Math.random() : It return a random number between 0 and 1.
2 ) Math.max(15,10) : It return the number with the highest value of two specified numbers.
3) Math.min(25,40) : It return the number with the lowest value of two specified numbers.
That one really helpful me its very easy but it help me a lot so i share it with you.
I hope it helps to all.
// This one is very to easy but i want to share it because today i waste my 3 hour in one simple line code
// I just want to do one simple this like if i get value
3.5 it would be 4 same as,
4.1 it would be 4 same as,
4.9 it would be 5 same as.
It means simple ROUND .
But i didnt think about MATH function at that time . I just try it my own way that one is successful but here one simple mathod ROUND in MATH with the use of this function i easily get may goal.
Example :
- var ratingInfo = Math.round(2.5);
- var ratingInfo = Math.round(3.9);
- var ratingInfo = Math.round(4.1);
- var ratingInfo = Math.round(2.7);
- 3
- 4
- 4
- 3
There are lots of other part method is available in MATH .
Like
1 ) Math.random() : It return a random number between 0 and 1.
2 ) Math.max(15,10) : It return the number with the highest value of two specified numbers.
3) Math.min(25,40) : It return the number with the lowest value of two specified numbers.
That one really helpful me its very easy but it help me a lot so i share it with you.
I hope it helps to all.
No comments:
Post a Comment