Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

263 total results found

Objects and object references

NodeJs/JavaScript JavaScript Roadmap Journey

Objects In JavaScript objects are used to store key to value pair collection of data. You can think of them as dictionary in Python. You can create an object using brackets { }, and a list of optional properties that the object will have. For example: let e...

React Basics

Garbage collection

NodeJs/JavaScript JavaScript Roadmap Journey

Reachability In JavaScript garbage collection is implemented through something called reachability. Variable that are reachable are kept in memory and not deleted by the garbage collector. A value is considered to be reachable if it's reachable from a root ...

Software Engineering Principles

Constructor and "new" operator

NodeJs/JavaScript JavaScript Roadmap Journey

Constructor function Function that is meant to be a constructor are named with capital letter first and be executed with the new operator. We use a constructor because it creates a shorter and simpler syntax compared to creating object with {...} every time....

Optional chaining

NodeJs/JavaScript JavaScript Roadmap Journey

Optional chaining There is this problem that if the object that you are accessing might or might not contain an object attribute say address and you can trying to access address's attribute further say user.address.street, then your JavaScript will crash beca...

Symbol Type

NodeJs/JavaScript JavaScript Roadmap Journey

Symbols In JavaScript there is two primitive types that can be used as object property key String Symbol type Don't confuse the symbol type in Ruby with JavaScript they are different albeit similar in that they are used to create unique identifier. A ...

Arrays and methods

NodeJs/JavaScript JavaScript Roadmap Journey

Array Two ways of creating empty array let arr = new Array(); let arr = []; Create an array with elements in them let arr = ["Apple", "Orange", "Plum"]; Array in JavaScript is heterogeneous, you can store element of any type in them. arr.length property...

Iterables

NodeJs/JavaScript JavaScript Roadmap Journey

Iterables A generalization of arrays, it allows us to make any object iterable in the context of for ... of loop. Making an object iterable just requires you to add the Symbol.iterator hidden property which is a function that returns the iterator. Really dou...

Map and set, weakmap and weakset

NodeJs/JavaScript JavaScript Roadmap Journey

Map Very similar to an object, however, with object the only key that is allowed is a String. Map on the other hand allows keys of any type. Any type as it ANY type, even an object can be used as a key new Map(): Creates a new empty map map.set(key, value...

Destructuring assignment

NodeJs/JavaScript JavaScript Roadmap Journey

Destructuring assignment A special syntax to let us unpack either array or object into different variables Array destructuring let arr = ["Ricky", "Lu"] let [firstName, lastName] = arr; console.log(firstName); // "Ricky" console.log(lastName); // "Lu...

JSON

NodeJs/JavaScript JavaScript Roadmap Journey

JSON file When you want to transport say a complicated object or an array of object to another compute using network. You cannot transport a complicated object just directly as "it is". You must serialize it which essentially turns the object into a stream of...

Miscellaneous function topics

NodeJs/JavaScript JavaScript Roadmap Journey

Rest parameters and spread syntax How do we make a function take in an arbitrary number of arguments? Simple we use the ... rest operator in the function header. function sum(...args) { let sum = 0; for (let arg of args) sum += arg; return sum; } ...

Getters & setters

NodeJs/JavaScript JavaScript Roadmap Journey

Virtual property In addition to the normal property that we have for objects, we can also set up virtual properties. They appears to the outside code as if they were the object's property but they are actually implemented as functions underneath. let user = ...

All about prototypes

NodeJs/JavaScript JavaScript Roadmap Journey

Prototype inheritance Every object have a special hidden property [[Prototype]] it is either null or a reference to another object. Whenever you read a property from object and if it is missing, JavaScript will automatically take it from the prototype. Sett...

Classes in JavaScript

NodeJs/JavaScript JavaScript Roadmap Journey

Class basic syntax Besides using a constructor function there is a more advance object oriented programming construct called class in JavaScript. The basic syntax is as follows: class MyClass { constructor() {} method1() {} method2() {} } To ut...

Try...catch

NodeJs/JavaScript JavaScript Roadmap Journey

Syntax try { // Code } catch (err) { // Error handling } finally { // Excuted always, regardless if there is any error. And is always last // It is also executed right before you return if you decide to return/throw from try and catch } Keep ...

Promises and promise chaining

NodeJs/JavaScript JavaScript Roadmap Journey

Time before promise, callbacks There are entities in JavaScript that let you schedule asynchronous tasks, tasks that you initiate first, then they will finish later. Task like disk reading, fetching resources from network that will take arbitrary amount of t...