sample: truncating decimal number
by sii_side
JavaScript
var num = 1.725469;
window.alert(
"そのまま: " + num + "\n" +
"parseInt: " + parseInt(num) + "\n" +
"Math.floor: " + Math.floor(num) + "\n" +
"|演算子: " + (num | 0)
);
by sii_side
var num = 1.725469;
window.alert(
"そのまま: " + num + "\n" +
"parseInt: " + parseInt(num) + "\n" +
"Math.floor: " + Math.floor(num) + "\n" +
"|演算子: " + (num | 0)
);