July 18, 2022 - 2 min to read
July 18, 2022 - Last updated
JavaScript concepts to remember
Learn useful javascript fundamentals that apply regularly when we write code
July 18, 2022 - 2 min to read
July 18, 2022 - Last updated
Learn useful javascript fundamentals that apply regularly when we write code
This article is just a piece of my notepad that outlines some JavaScript concepts I don't necessarily forget but still have to check on just to be sure 😅. One reason for this post is because I am more likely to reach out for my device (and check the internet) than a physical notepad or even a note app and another reason is the ease of sharing with you.
An unstructured region of memory where global variables and objects are stored.
This pulls functions out of the event or callback queue and places it in the call stack when it becomes empty.
This represents the single thread provided for JavaScript code execution and keeps track of the operations to be executed. Whenever a function is finished, it is popped from the stack. The stack operates in a LIFO queue where the last function call in a function gets executed first.
This holds mostly async functions processed by the web APIs so that when they are ready to run, the event loop can pull from it and add to the callstack.
This occurs when a function is being declared and returned in another function and this is done so that the inner function can have access to the scope of the outer function even after the outer function has been executed.
This is the process where the JavaScript interpreter moves declaration of functions, variables or classes to the top o their scope prior to code execution
This is the region in which a block of code has access to the variables defined in that scope.
A promise is an object representing the eventual completion or failure of an asynchronous operation. It is a special JavaScript object that initially has a pending state with an undefined value which when resolved, becomes a fulfilled state with a value as the result or becomes a rejected state with an error as the result.
The promise object has methods like then
, catch
and finally
.
These keywords make handling asynchronous code more readable. The async
keyword makes a function return a promise while the await
keyword suspends further JavaScript code execution until the promise resolves.