Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 8, 2019 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/97a13713f1a5cd93de37773829cd4398 to your computer and use it in GitHub Desktop.
Save parzibyte/97a13713f1a5cd93de37773829cd4398 to your computer and use it in GitHub Desktop.
Truncar o remover decimales de número en JavaScript - https://parzibyte.me/blog/2018/09/13/remover-decimales-de-numero-en-javascript/
console.log(Math.trunc(15)); // 15
console.log(Math.trunc(15.58151)); // 15
console.log(Math.trunc(0)); // 0
console.log(Math.trunc(-0)); // -0
console.log(Math.trunc(100.00)); // 100
console.log(Math.trunc(-150.68)); // -150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment