Number.toFixed() ফাংশনটি ডেসিমেল পয়েন্টের পরে কতগুলো ডিজিট থাকবে সেটি নির্দিষ্ট করে সংখ্যাকে ফিক্সড-পয়েন্ট নোটেশনে রূপান্তর করে।
সিনট্যাক্স
num.toFixed(digits)
উদাহরণ
<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: " + 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 = 2.13e+15; document.write("Fixed point notation: " + num.toFixed(4)); </script> </body> </html>
আউটপুট
Fixed point notation: 2130000000000000.0000