Power up the array creation in JavaScript

The array is an ordered collection of objects or primitive types. It's hard to imagine an application that doesn't use this data structure. Working with arrays consists in the following phases: Initialize the array and setup the initial elements Access the array elements by index Add new elements Remove existing elements The current article covers the array initialization and setting the initial elements. The basic… Continue reading

When 'not' to use arrow functions

It is a pleasure to see the evolution of the programming language you code every day. Learning from mistakes, searching for better implementation, creating new features is what makes the progress from version to version. This is happening to JavaScript these years, when ECMAScript 6 brings the language to a new level of usability: arrow functions, classes and a lot more. And this is great!… Continue reading

Inheritance in JavaScript: understanding the constructor property

JavaScript has an interesting inheritance mechanism: prototypal. Most of the starting JavaScript developers have hard time understanding it, as well as I had. All types in JavaScript (except the null and undefined values) have a constructor property, which is a part of the inheritance. For example: var num = 150; num.constructor === Number // => true var obj = {}; str.constructor === Object // => true var reg = /\d/g;… Continue reading