reverse number in js
// Function to reverse Number
function reverseNum(n) {
let r = n.toString().split('').reverse().join('');
return Math.sign(n) * parseInt(r);
}
// Call
reverseNum(-267);
reverseNum(31522);
// Outputs
-762
22513function reversedNum(num) {
return (
parseFloat(
num
.toString()
.split('')
.reverse()
.join('')
) * Math.sign(num)
)
}const reversedNum = num => parseFloat(num.toString().split('').reverse().join('')) * Math.sign(num)
Also in JavaScript:
- remove last comma from string javascript
- readfilesync
- mongoos populate a ref
- creating a table in js
- fixed div with scrollable content
- javascript read json file
- how to check if 2 sprites are touching js
- javascript the difference between innerText vs. innerHTML vs. textContent
- javascript redirect to another page
- gatsby-plugin-create-client-paths
- jquery open page in new tab
- map()
- reference body js
- js camel case to snake case
- jspdf create table
- attempt to invoke virtual method 'android.graphics.drawable.drawable react native
- mongoose if empty string is provided use default
- check unique object in array javascript site:stackoverflow.com
- jquery each has class
- express unique validator for the owner
- get data from column in table js
- repeat a function javascript
- javascript const
- how to render file vue template in javascript with gulp