Difference between slice & splice

First class functions

In Javascript, functions are first class objects. First-class functions means when functions in that language are treated like any other variable. For example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable. For example, in the below example, handler functions assigned to a listener

 

 

const handler = () => console.log ('This is a click handler function');
document.addEventListener ('click', handler);

 

Higher Order Function

 

Higher-order function is a function that accepts other function as an argument or returns a function as a return value.

const increment = x => x+1;
const higherOrder = higherOrder(increment);
console.log(higherOrder(1));

currying function ?

 

Currying is the process of taking a function with multiple arguments and turning it into a sequence of functions each with only a single argument. Currying is named after a mathematician Haskell Curry. By applying currying, a n-ary function turns it into a unary function. Let's take an example of n-ary function and how it turns into a currying function

const multiArgFunction = (a, b, c) => a + b + c;
const curryUnaryFunction = a => b => c => a + b + c;
curryUnaryFunction (1); // returns a function: b => c =>  1 + b + c
curryUnaryFunction (1) (2); // returns a function: c => 2 + c
curryUnaryFunction (1) (2) (3); // returns the number 6

Difference between Var  and  let

 

 

 

Done

JS INT-08

By Tarun Sharma

JS INT-08

React

  • 405