There is also Function constructor:
var sum = new Function('a,b', 'return a + b');
Note that Functions are instances of Function.
(function() {}) instanceof Function;
Great Jakub.
I wanted to add this one in the article, but it's not really widely used.
You're right, but to be complete you need to know about it.
Also, you missed named function expressions:
const mul = function recur(a, b){ if (a === 0) { return b; } return recur(a -1, b + 1); };
and immedietly invoked function expressions:
(function() { const x = 10; console.log({x}); })();
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There is also Function constructor:
Note that Functions are instances of Function.
Great Jakub.
I wanted to add this one in the article, but it's not really widely used.
You're right, but to be complete you need to know about it.
Also, you missed named function expressions:
and immedietly invoked function expressions: