কম্পিউটার

জাভাস্ক্রিপ্টে Number.toFixed() ফাংশন


সংখ্যা অবজেক্টের 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

  1. জাভাস্ক্রিপ্ট নম্বর ফাংশন

  2. জাভাস্ক্রিপ্টে সংখ্যাকে অক্ষরে রূপান্তর করুন

  3. জাভাস্ক্রিপ্টে একটি সংখ্যা ফ্যাক্টরাইজ করুন

  4. জাভাস্ক্রিপ্টে Number.toLocaleString() ফাংশন