js rounding
//There are meny ways of rounding...
Math.floor(5.5) //Answer 5, it alwas rounds down.
Math.round(5.5) //Answer 6, it simpily rounds to the closest whole number.
Math.ceil(5.5) //Answer 6, it alwas rounds up.
//You can do more things too...
Math.floor(5.57 * 10) / 10 //Answer 5.5, the number turns into 55.7, Then gets floored (55.0), Then gets divied, (5.5).var avg=10.55;
console.log(Math.round(avg)); //Prints 11
Also in JavaScript:
- reverse a linked list javascript
- Javascript remove array item by value
- jstl expects equals
- data-dismiss= modal in jquery
- get a user input react
- react admin newrecords.foreach is not a function
- jquery set title
- get and set es6
- js array to comma separated list
- horizontal scrollview in react js
- javascript test if it is an array
- string charat javascript
- java script remowechild an element from the DOM
- javascript get last element of array pull
- angular how to get previous state
- javascript find area of triangle
- mongodb replace document
- javascript get random array of integre in given range
- Caesars Cipher javascript
- anagram program in javascript
- javascript append element to array
- javascript check if all capital letter
- load jquery in the browser code
- javascript reverse each string element in array