DEV Community

Hihi
Hihi

Posted on

My notes on Javascript functions and related things.

I write some writeup thoughts while learning on frontendmaster.

Execution context

When a function is invoked, keep in mind that that function will attach to 2 things:

  • thread: the ability to run the code in the function from top to the bottom;
  • local memory: where the function saves their local variables & inner reference values. That 2 things is called execution context.

Block scope

Only the functions can create its own execution context, other code block, loops,... don't create.
So all the variables and values once involved in that function will be locked in and can't be accessed outside.

Closure

The ability of accessing values from outer scope. To deeply understand closure you should have a notion of what execution context is.

Higher order function

HOF is an idea of passing function as an argument to another function. This concept give us an idea of freely modification make our code more reusable.

Top comments (0)