Answers for "js how to filter only real numbers from decimals"

0

js how to filter only real numbers from decimals

const arr = [3, 4.5, 6, 1.1]
const integers = arr.filter(n => Number.isInteger(n));
console.log(integers)
// output [3, 6]
Posted by: Guest on August-25-2021

Code answers related to "js how to filter only real numbers from decimals"

Code answers related to "Javascript"

Browse Popular Code Answers by Language