10 Useful JavaScript Concepts

Md. Jidanul Hakim Jitu
4 min readNov 2, 2020

1. STATIC PROPERTIES (Numbers)

Static properties are utilized when we’d prefer to store class-level information, additionally not bound to an occurrence.

Number.EPSILON:

The littlest span between two representable numbers.

Number.MAX_SAFE_INTEGER:

It contains the maximum safe integer value in JavaScript.

Number.MAX_VALUE:

If you see the name ‘max’ on heading you can concern that there will be that thing which might be bigger or largest. And that has really happened here. It contains the largest positive representable number.

Number.MIN_SAFE_INTEGER:

There is minimum in the name of the method including safe integer. So it contains the minimum safe integer in JavaScript.

Number.MIN_VALUE:

If you see the name ‘min’ on heading you can concern that there will be that thing which might be smaller. And that has really happened here. It contains the smallest positive representable numbers. And yes it will be happened without being zero.

Number.NaN:

NaN means => Not a Number. So the value which can’t be defined as a number javascript shows that the number is actually not a number.

2. STATIC METHODS (Numbers)

A static method belongs to the class rather than object of a class. A static method invoked without the need for creating an instance of a class. static method can access static data member and can change the value of it.

Number.isNaN():

It determines that a passing value by user is a number or not.

Number.isFinite():

Here is finite in the term. So it can be easily said that this terms determines that a passing value by user is a Finite number or not.

Number.isInteger():

Integer in the name of term. So this term mainly checks the value that is passing by a user is an integer or not.

Number.isSafeInteger():

Unlike the last one it mainly checks if a value that is passing by a user is a safe integer or not.

3. INSTANCE METHODS (Numbers)

The instance method is methods that require an object of its class to be created before it can be called. To invoke an instance method, we have to create an Object of the class within which it defined.

Number.prototype.toExponential(fractionDigits):

This method returns a string speaking to the number in outstanding documentation.

Number.prototype.toFixed(digits):

This method returns a string speaking to the number in fixed-point documentation.

Number.prototype.toPrecision(precision):

It’s actually a combination of last two methods. This method returns a string speaking to the number to a predetermined accuracy in fixed-point or remarkable documentation.

4. STRINGS

Strings contain a series of character. It mainly created by putting double quotes on a sentence, word or any character. In JavaScript, strings are not objects. They are primitive values. However, there exist String objects which can be used to store string values, but those String objects are not used in practice.

Example:

const sakib = [“s”, “a”, “k”, “i”, “b”]

In this variable every single character in between the double quotes is a character.

5. CONSTRUCTOR (Strings)

String():

It performs type change when called as a capacity, instead of as a constructor, which is typically more helpful. It mainly creates a new String object.

6. OBJECT

An object is an assortment of properties, and property is a relationship between a name (or key) and a worth. A property’s estimation can be a capacity, in which case the property is referred to as a methodproperty is known as a technique. JavaScript is an Object-oriented programming language.

Notwithstanding objects that are predefined in the program, anyone can characterize his own personal objects.

7. ARRAY

Arrays are list-like and exhibit items whose model has strategies to perform crossing and transformation activities. Neither the length of a JavaScript cluster nor the sorts of its components are fixed. Since a cluster’s length can change whenever, and information can be put away at non-bordering areas in the exhibit, JavaScript exhibits are not destined to be thick; this relies upon how the developer decides to utilize them. As a rule, these are advantageous qualities; yet if these highlights are not alluring for your specific use, you should seriously mull over utilizing composed clusters.

8. Enumerate the properties of an object

There are three ways to list object properties. The are 1. for…in loops, Object.keys(0), Object.getOwnPropertyNames(0).

for…in loops:

This technique navigates all enumerable properties of an object and its model chain.

Object.keys(0)

The method returns an array with all own enumerable properties’ name.

Object.getOwnPropertyNames(o)

This method returns with all own properties method. It may be enumerable or not!

9. FUNCTION

Capacities made with the Function constructor don’t make terminations to their creation settings; they generally are made in the worldwide extension. When running them, they may have the option to get to their own personal neighborhood factors and worldwide ones, not the ones from the extension where the Function constructor was made. This is not quite the same as utilizing eval with code for a capacity articulation.

Function()

Aalling the constructor legitimately can make works progressively yet experiences security and comparable (yet far less critical) execution issues to eval.

10.Undefined

The undefined property indicates that a variable has not been assigned a value, or not declared at all. It might be happened per year.

--

--

Md. Jidanul Hakim Jitu

I am a goal-oriented problem solver with energy for web development, who might want to join a group of similar engineers.