Self invoking functions are anonymous functions which do not need to be called to return a value.

PHOTO EMBED

Fri Sep 16 2022 13:36:35 GMT+0000 (Coordinated Universal Time)

Saved by @sreejithbs

(function(n) {
  console.log(n * n)
})(2) // 4, but instead of just printing if we want to return and store the data, we do as shown below

let squaredNum = (function(n) {
  return n * n
})(10)

console.log(squaredNum)
content_copyCOPY

https://github.com/Asabeneh/30-Days-Of-JavaScript/blob/master/07_Day_Functions/07_day_functions.md