10 tricky things in JavaScript
Nov 5, 2020
- Remove Duplicates from an Array : We easily remove data from an array to use some way like as filter Method, set, forEach Method, reduce Method, Array Prototype, Underscore JS.
- Reverse a string : Its a very interesting topic in JavaScript. There are 3 way to reverse a string such as split() method, use For Loop and Recursion way.
- Bind : Bind creates a new function. Its allow an object to borrow an another object.
- Global variable : Global variable is very useful in JavaScript. Its access anywhere and anywhere call this.
- Keyword new : Its a very speacial word in Javascript. Its ceate a object from class constructor.
- Closures : If we use a function in an another function and return a result to main function then there two function are create a envirment its called Closures.
function timer(){
let count = 0;
return function () {
count++;
return count;
}
}const time = timer();
console.log(time());const time2 = timer();
console.log(time2());
7. Truthy Vs Falsy : Both are boolean concept Truthy value is considered the value of true and Falsy is considered false.
8. Nun Vs undefined : Nun is empty value. Undefined is declaredvariable but undefinite.
9. Double equal Vs triple equal : Triple equal cheack value and type but double equal only compare type or close anything.
10. Recursive : We do many problem solve use recursive way. Its always has a conditon that stops the function from calling itself.