-
Javascript Math
In JavaScript, Math is a built-in object. It has both properties and methods for mathematical functions and constants. Math operates with the Number type, but never with BigInt. Unlike other global objects, Math is not considered a constructor. The methods and properties of Math are fixed. You can call them by applying Math as an object without creating it. So, you refer to constant pi as Math.PI. Hence,…
-
JavaScript Numbers
Two types of numbers can be highlighted in modern JavaScript: Regular and bigInt. The Ways of Writing a Number Let’s say you want to write one billion. This is the most common way: In our practice, we commonly try to keep away from writing many zeroes. We prefer to write, for example, “1bn”. Now, we will…
-
JavaScript Methods of Primitives
In JavaScript, it is possible to work with primitives (numbers, strings, and more), as if they were objects. But, of course, there are notable differences between objects and primitives. So, primitive is a primitive type value. Seven types of primitives exist, among them are: number, bigint, symbol, string, boolean, null and undefined. An object can store multiple values as properties. You can create an object using {}. For example: Other kinds…