Understanding the difference between scope and context in a JavaScript method

Sometimes the concepts of scope and context are misunderstood in JavaScript. It is important to understand that they are not the same thing. This is particularly important inside of a method. In JavaScript, the concept of scope refers to the visibility of variables. On the other hand, the concept of context is used to mean: […]

Easy JavaScript Object Context Switching with jQuery.proxy()

A popular saying in the Real Estate business is: “Location, location, location!” Well, in JavaScript, it’s all about “context”. When you want to leverage the very powerful keyword: “this”, then understanding the current context is critical. So, those experienced with native JavaScript should be comfortable with the concept of context (If you are not, take […]

What is the Difference Between Scope and Context in JavaScript?

In JavaScript, scope and context are not the same thing, and it’s important to understand the difference between them. Fortunately, the answer is short and simple. Why Should We Care About Scope and Context ? When interviewing front-end developers, I usually try to include a question about scope and context in JavaScript. I always ask […]

Understanding Context in JavaScript – Object Literals

Why is the word “this” so important in JavaScript? In the post: “Understanding Scope in JavaScript,” I covered the basics of how scope works when dealing with functions. Sometimes the words “scope” and “context” are used interchangeably, which only leads to confusion because they are not the same thing. In JavaScript, “context” refers to an […]

Introduction to the JavaScript Array find() method

JavaScript’s Array find() method allows you to find the first element that matches logic provided by you. When you have an array of values, it’s likely that you might need to find an element in that array. In particular, you might want to know which element in this array meets a certain criterion. Well, the […]

JavaScript Template Literals – Basics

Template Literals introduce a new syntax into JavaScript. The backtick character provides a way to have placeholders as well as multi-line text without special characters. Working with strings is a daily activity for most JavaScript developers. One of the most common challenges is dealing with multi-line text. This is not an unsolvable problem, but it […]

Creating your First Node Module

By defining your node module in package.json, you do not need to be concerned about its physical location when referencing it in your code. Sometimes your Node.js application depends on functionality that falls outside of Node’s core components. In this case, you’ll need to import that functionality. This can be achieved with a node module. […]

Fat Arrow Function Basics – Node Modules

JavaScript Fat Arrow Functions solve the “this” problem by maintaining a reference to the object to which a method belongs. This is the case even with nested functions. One of the most popular aspects of JavaScript is the fact that functions are first-class citizens. So, this aspect of the ECMAScript specification provides a great deal […]

Node.js File Uploads with Multer

When it comes to the UI, file uploads are pretty simple. But on the back-end, there is some work to do. Multer is a Node.js module that simplifies this process. Uploading a file is a common task for Web applications. Today, most Web pages leverage AJAX — which requires JavaScript — for a smoother user […]

How to Fly to a Location With the Mapbox Maps SDK for React Native

Using the flyTo() method, you can zoom out, move to a target location, and then zoom back in. To do this, you only need to tell the MapBox api the coordinates of the target location and the animation duration. Being able to move from one geo-specific location to another is a critical feature for any […]

MongoDB Shell vs MongoDB Node.JS Driver

The mongo Shell and the MongoDB Node.JS Driver both provide a way to interact with a Mongo database. There are fairly significant differences in how they work, however, as well as the benefits they provide. There are multiple ways to interact with MongoDB, and two of those are with the mongo shell and the MongoDB […]

How do I use the Angular ngIf Directive?

Angular’s ngIf directive does not simply hide and show. It creates and destroys an HTML element based on the result of a JavaScript expression. It’s perfectly fine to use the Angular ngIf directive to hide / show one or more HTML elements. This is the net effect and when used wisely, there is no problem […]

The Paradox of JavaScript

Are you getting an ECMA-Headache? In the book: The Paradox of Choice: Why More Is Less, author Barry Schwartz argues that too many choices can dilute satisfaction. While this title spends much of its time in the context of consumer products, a similar argument can be made about the world of JavaScript. There is so […]

Getting Started with Highcharts Part I: Basic Charts

Learn how to incorporate data visualization into your web page with just a few links of JavaScript The data visualization trend shows no signs of slowing down, and charting is a key skill in that area. Highcharts is a jQuery plugin that provides a simple interface for creating great looking charts. There is a tremendous […]

Getting started with the uglify-js Node.js module

Learn how to easily implement minification and file concatenation right in your Node.js program. There is no doubt that tools such as grunt and gulp provide powerful front-end tooling, particularly for large-scale applications. But in some cases, you may want to “roll your own”. If you want to minify and / or concatenate files from […]

What are the Best Tutorial Videos for Web Performance?

Learn about web performance from the experts. These videos provide a wealth of knowledge about how to make web pages faster. Everyone knows what happens when a page loads slowly: the visitor leaves. That much is simple. But what is not always so obvious is what to do when you have addressed the “low-hanging fruit.” […]

Getting Started with ECMAScript 6 Arrow functions – The “this” keyword

Other than syntax, the biggest change that ECMAScript Arrow Functions brings about, is how it relates to context: in the function body, “this” has a different meaning than you may expect. It seems to me that the two problems that are solved by ECMAScript 6 Arrow functions are: verbose syntax and the tricky nature of […]

Getting Started with Backbone.js Models – Part II : Creating an Initialize Method

In the previous post: “Getting Started with Backbone.js Models – Introduction,” I discussed how the extend method of the Backbone.Model constructor is extended, which results in a new “class” that you can instantiate. When extending this constructor, an object was passed-in, which contained default values for the model data. Those default values were key/value pairs […]

When did Walmart become so hip?

WalmartLabs is doing some very cool things with Node.js. When the heck did all this happen? Did you know that Walmart supports nearly 30 open-source modules, most of which are used in production, or that they created their own “private npm” to prevent hacks? Nope, neither did I. I must admit, Walmart is not a […]

The JavaScript “this” Keyword Deep Dive: Constructor Functions

Learn how the JavaScript “this” keyword differs when instantiating a constructor (as opposed to executing the function). In earlier articles of the “The JavaScript “this” Keyword Deep Dive” series, we discussed how the meaning of “this” differs in various scenarios. In this article, we will focus on JavaScript constructors. It is critical to keep in […]