번호 | 기본값 | 메서드 | 결과값 |
---|---|---|---|
{
document.querySelector(".sample01_R1").innerHTML = (0.8888).toFixed(1);
document.querySelector(".sample01_R2").innerHTML = (0.8888).toFixed(2);
document.querySelector(".sample01_R3").innerHTML = (0.8888).toFixed(3);
//소수점을 기준으로 무조건~!
document.querySelector(".sample01_R4").innerHTML = (123.8888).toFixed(1);
document.querySelector(".sample01_R5").innerHTML = (123.8888).toFixed(2);
document.querySelector(".sample01_R6").innerHTML = (123.8888).toFixed(3);
}
번호 | 기본값 | 메서드 | 결과값 |
---|---|---|---|
{
document.querySelector(".sample02_R1").innerHTML = (1.23456).toPrecision();
document.querySelector(".sample02_R2").innerHTML = (1.23456).toPrecision(5);
document.querySelector(".sample02_R3").innerHTML = (1.23456).toPrecision(3);
document.querySelector(".sample02_R4").innerHTML = (1.23456).toPrecision(1);
document.querySelector(".sample02_R5").innerHTML = (0.123456).toPrecision();
document.querySelector(".sample02_R6").innerHTML = (0.123456).toPrecision(5);
document.querySelector(".sample02_R7").innerHTML = (0.123456).toPrecision(3);
document.querySelector(".sample02_R8").innerHTML = (0.123456).toPrecision(1);
}
번호 | 기본값 | 메서드 | 결과값 |
---|---|---|---|
{
document.querySelector(".sample03_R1").innerHTML = parseInt("1.23456");
document.querySelector(".sample03_R2").innerHTML = parseFloat("1.23456");
}