2022.06.25 🌙
Number.prototype.toFixed(parameter) 용법 [JS]
입력받은 숫자에 맞게 해당 number 의 소숫점 자릿수까지 표현 해준다
function financial(x, y) {
return Number.parseFloat(x).toFixed(y)
}
console.log(financial(123.456, 2)); // 123.46
console.log(financial(123.456, 0)); // 123
console.log(financial(123.456, -1)); // RangeError: toFixed() digits argument must be between 0 and 100
console.log(financial(123, 3)); // 123.000
background-color: transparent [CSS]
어떤 항목의 배경색으로 부모 항목의 배경색을 그대로 상속 받아 적용 해준다
<html>
<head>
<style>
body { background-color: green; }
div { width: 200; height: 200; }
div:first-child { background-color: white; }
div:second-child { backgound-color: "transparent"; }
</style>
</head>
<body>
<div></div> <!-- background-color: white; -->
<div></div> <!-- background-color: green; -->
</body>
</html>