Javascript Intermediate 13 - Nodejs debugging on the CLI
There may be thousands of libraries and utilities that allow you debug nodejs projects, but I am going to write few lines on how to do it using the node built-in tool.
Is not nearly as powerful as gdb , but using the right strategy to approach the process can clarifying as well as timesaving, as you wont be needing to install some other addition...
Javascript Intermediate 12 - Method chaining in Javascript
Method chaining is a programming technique to allow better readiblity and writeability of objects, that allow you to call any instance method of the same object on the return object of another instance method.
May be cryptic the definition, but lets see with an example.
You declare a Class , with some instance methods (we are going to use pseu...
Javascript Intermediate 11 - Traversing the Javascript standard-library Object Model
First of all there is not a clear definition of Standard-Library for Javascript as it depends on the context of execution that varies a lot , depending if you are running it on a Browser, or on a container such as node.js we will be using the later one.
The global object is binded to globaThis
So you can see all of the Global Objects derived fr...
Javascript Intermediate 10 - Class syntax in Javasript as an abstraction from prototypical inheritance
Distinction between fields and properties
Within a class body, there are a range of features available.
The structure of a class definition via the class keyword is
class MyClass {
// Constructor
constructor() {
// Constructor body
}
// Instance field
myField = "foo";
// Instance method
my...
Javascript Intermediate 9 - Inheritance model with a prototype chain, a demostration with pseudoclassical inheritance
Runtime Code vs Library Code
First of lets clarify a distinction between the following concepts in a programming language.
Core or runtime code of a Programming language: Defines the interpreter or compiler
Library Code : Code written on the same programming language (same level of abstraction) that defines basic functionalities that every...
Javascript Intermediate 8 - Differences between __proto__ and .prototype on Constructor Functions
Now that we have established the relationship between instanceObject.__proto__ (we are going to use Object.getPrototypeOf()) , and Constructor.prototype we see that.
function Food () {
}
var popcorn = new Food();
console.log(Object.getPrototypeOf(popcorn) === Food.prototype); // True
We can set its prototype properties as
function Food () ...
Javascript Intermediate 7 - Differences between __proto__ and .prototype on Objects
In its most basic form proto is a built-in property in all objects in JS , that you set to other object so it inherits its properties.
The firstObject will inherit secondObjects properties , and the properties of the secondObject.proto object and so on.
let tangible = {
isTouchable: true
}
let resource = {
hasUtility: true,
__proto_...
Javascript Intermediate 6 - What is a prototype
First off
All object literals in javascript inherit from Object.prototype global object
var myObject = { };
console.log(myObject instanceof Object); // True
console.log(myObject instanceof Function); // False
Also, out of the inheritance model we can say that
Javascript objects have a property called prototype accessed as proto ,...
27 post articles, 4 pages.