Javascript tricky concepts.

Mohiuddin Mazumder
2 min readNov 5, 2020

1.Javascript truthy and flashy

In JavaScript, a truthy value is a value that is considered true when encountered in a Boolean context. All values are truthy unless they’re defined as falsy (except for false, 0, -0, 0n, “”, null, undefined, and NaN).

2.null vs undefined

In JavaScript, undefined is a type, whereas null an object. It means a variable declared, but no value has been assigned a worth. Whereas, null in JavaScript is an assignment value. You can assign it to a variable.

3. == vs ===

== in JavaScript is employed for comparing two variables, but it ignores the datatype of variable.Checks the equality of two operands without considering their type.

=== is used for comparing two variables, but this operator also checks datatype and compares two values. If two variable values are not similar, then === will not perform any conversion.

4. map()

The map() method creates a replacement array with the results of calling a function for each array element. The map() method calls the provided function once for every element in an array, in order

5. filter()

The filter() method creates an array crammed with all array elements that pass a test (provided as a function). filter() doesn’t execute the function for array elements without values. filter() does not change the original array.

6. find()

The find() method returns the worth of the primary element within the provided array that satisfies the provided testing function.

7.slice()

The slice() method returns the chosen elements in an array, as a replacement array object.

8.splice()

The splice() method adds removes items to from an array, and returns the removed item(s). This method changes the original array.

9.bind()

The bind() method creates a replacement function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called

10.new

The new operator lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function

--

--