javascript - what is the purpose of numeric/boolean/string objects as opposed to primitive values? -


In javascript you can call function as function or as constructor. For example, you can:

  myObject = new number (13); MyPrimitiveValue = Number (13);  

or simply

  myPrimitiveValue = 13;  

Can you please tell me the difference between the results under which in the appropriate circumstances is string desirable in the form of a number, a boolean or an object? For example, the ability to set new properties (this is something that you can do on objects but not really on primitive values) is a bad idea for objects with approx / objects / boolean / string. Why do I need a numerical / boolean / string object?

You have to create objects for at least the original data type.

From the Microsoft documentation:

"The number object is a cover for numerical data. The primary purpose for the number object is its assets in one object and string is passed to the string method The number object number is the same as the data type, however, they have different properties and methods.

You rarely have to specify a number object. Since the number of data types should be used in most situations, since the number object number works with the data type, all the numbers are available for a variable of the object methods and property types. "


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -