Number Object in JavaScript || Methods and Properties of Number Object ||JavaScript Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024
  • #numberobject #javascripttutorialforbeginners #javascript
    Number object in JavaScript:-
    ---------------------------------------
    The Number object in JavaScript is a built-in object that represents numbers.
    It can be used to work with numbers in JavaScript.
    To create a Number object, we can use the Number() constructor. The Number() constructor takes a number as its argument.
    var a = new Number(10);
    Methods of Number object:-
    -----------------------------------
    1. toString(): Converts a number to a string.
    2.toFixed() : Returns the value of the Number object as a string with a specified number of decimal places.
    3.toPrecision(): Returns the value of the Number object as a string with a specified length
    4.toExponential(): Returns the value of the Number object as a string in exponential notation.
    5.parseInt(): Parses a string and returns an integer.
    6.parseFloat(): Parses a string and returns a floating-point number.
    Properties of Number object:
    ---------------------------------------
    MAX_VALUE: The maximum representable number in JavaScript.
    // 1.7976931348623157e+308
    MIN_VALUE: The smallest representable positive number.
    // 5e-324
    NEGATIVE_INFINITY: A value representing negative infinity.
    // -Infinity
    POSITIVE_INFINITY: A value representing positive infinity.
    // Infinity
    NaN: A special value representing "Not-a-Number".
    // NaN

ความคิดเห็น • 3

  • @likithakuntala8764
    @likithakuntala8764 ปีที่แล้ว

    good morning sir

    • @SudhakarAtchala
      @SudhakarAtchala  ปีที่แล้ว

      Good morning. Plz subscribe to the channel and if possible share with your friends. Thanks in advance..