সংখ্যা অবজেক্টের toFixed() ফাংশনটি দশমিকের পরে প্রদর্শিত পয়েন্টের সংখ্যা প্রতিনিধিত্বকারী একটি সংখ্যা গ্রহণ করে এবং সেই অনুযায়ী বর্তমান সংখ্যা প্রদর্শন করে।
সিনট্যাক্স
এর সিনট্যাক্স নিম্নরূপ
num.toFixed(num);
উদাহরণ
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var num = Math.PI;
result = num.toFixed(4);
document.write("Fixed point notation of the given number is: " + result);
</script>
</body>
</html> আউটপুট
Fixed point notation of the given number is: 3.1416
উদাহরণ
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var num = Math.PI;
document.write("Fixed point notation of the given number is: " + num.toFixed(4));
document.write("<br>");
var num = 2.13e+15;
document.write("Fixed point notation of the given number is: " + num.toFixed(4));
</script>
</body>
</html> আউটপুট
Fixed point notation of the given number is: 3.1416 Fixed point notation of the given number is: 2130000000000000.0000