The JS Event Loop
Asynchronous events and non-blocking I/O
Node is a JavaScript interpreter for running apps outside the browser (like on a server, for example). It uses non-blocking I/O and asynchronous events, and each module is created within its own filed with an isolated scope. These are fundamental concepts to understand before being able to make Node interpretation work in the intended way, so . . .
Recursive Backtracking
To put it simply, the idea behind backtracking comes down to trial and error. If you can't think of a way to jump to finding the solution to a problem, there is always the strategy of just trying different things until one of them works. When you search for a solution, try a possibility; if you find yourself stuck, back up and try the . . .
Pseudoclassical vs. Prototypal: JavaScript allows both
There are two broad types of inheritance in programming: protoypal and classical. Prototypal just means that objects can inherit directly other objects, while classical involves objects being instances of classes, and subclasses inheriting from superclasses.
Pseudoclassical Inheritance
This type of object inheritance uses:
. . .
Staying DRY
One of the first things we learnt at university was to scan through our code at intervals to see if several parts share similarities and factor out the shared aspects into its own container of reusable code. This follows the DRY principle (i.e.'don't repeat yourself') and is a key principle any software developer must understand:
. . .'This' can be confusing
The keyword this is something I have found confusing from the get-go. Often it just doesn't seem to follow an intuitive pattern. For starters, this isn't necessarily bound to the function it appears within - just like any function argument, it could have a different binding each time the function is run.
There are only five ways . . .
{Object or Scope?}
Although both objects and scopes look quite similar and are both collections of key/value pairs, they are very different and don't actually overlap.
To add a variable to a scope, you have two options:
1. Set a new variable to an initial value all in one line:
var aPerson = {name: "jess"};
- Make a . . .
Execution Contexts
When a program runs, it builds up storage systems for holding variables and their values. These in-memory scope structures are referred to as 'execution contexts'.
These scopes differ to the lexical scopes in that they are built as the code executes (rather than as the code is typed). The rules surrounding in-memory scopes define . . .