Javascript

Understanding the Model-View-Controller (MVC) Pattern

One of the most basic and fundamental models for application architecture is the Model-View-Controller (MVC) pattern. Many architectures leverage this pattern – whether in a Ruby on Rails, server-side application or a React front-end interface – so it’s important to understand how, why, and so what?

Understanding the JavaScript Runtime Environment and DOM Nodes

The JavaScript engine is only one of several tools browsers use to deliver a user interface that is both dynamic and able to asynchronously interact with multiple databases and events. Other main components include WebAPIs (including the DOM), two queues, and the Event Loop.

How to use Handlebars.js for templating

Sometimes, we need to display the same basic HTML, but with some customized data interspersed here and there. The Handlebars.js library is perfect for this. It takes less than 5 minutes to learn how to use this simple and efficient templating tool.

Understanding Prototypal Inheritance and Object Creation Patterns in JavaScript

Probably the least understood aspect of JavaScript, the prototypal inheritance model is also coincidentally its most salient and powerful feature. This flexible system enables a rich variety of ways to create objects.

Creating a Calendar Day Converter from Gregorian to Persian

Let’s figure out how we can create an interactive interface that converts a Gregorian Month and Day to a Persian Month and Day, and vice versa. In the process, we’ll review some of the key Javascript concepts and methods for DOM manipulation.

How To Build a Multi-Step Form

Sometimes, forms are too long and can be intimidating to complete. The go-to solution is to create a multi-step form, where the form is broken up into smaller sections that the user completes progressively.

How To Sort Array Elements in Javascript and Ruby

Sorting an array is one of the most common things we have to do as software engineers. It can also sometimes be the fastest way to calculate a data point–for example, the highest possible product of any three numbers in an array.

Understanding Classes in Javascript

Integers, floats, strings, arrays, objects, functions, loops, scope? Piece of cake. Classes? Not so easy. Understanding what classes are, how they work, and how to incorporate them into your code is critical to developing any working enterprise application.

Syntax differences between Ruby and Javascript

I’ve been working with Javascript for a while now, and have gotten fairly comfortable with its syntax. I’m now also using Ruby again, which has a slightly different flavor. Here are some of the main syntactical differences between the two languages, in table format.

How to allow a child component to access and modify a parent's state in React

Let’s say your React application has a smart component (i.e. the component has its own state), and you want a child component to be able to not only access, but actually modify that parent component’s state.