Hoisting in javascript

Chandra Prakash Pal - Sep 6 '23 - - Dev Community

Hoisting is a features of JavaScript in which we can use any variable or function before initialisation.
for example

console.log(x)
x=10
var x
Enter fullscreen mode Exit fullscreen mode

same as we can do for function as well.

function createFunction(){
return f;
function f(a,b){
return a+b
}
}
const f=createFunction()
console.log(f(3,4)) // 7
Enter fullscreen mode Exit fullscreen mode

Please take reference from here

. . . . . . . . . . . . . . . .