All posts in JavaScript

Programming asynchronously: Promises

Promises are in many ways the logical next step from callback. A promise is just a special object that promise to either resolve, or throw an exception.

Read more

Programming asynchronously: Async Await

One of the big issues with using either callbacks or Promises is that the code becomes much more complex that it would, if you were using a synchronous programming language. This is where async and await comes in.

Read more

Slice or Splice Which one to Use?

In this article we will try to get a clear idea about Slice or Splice which one is better to use…

Slice

Slice is a method on the Array Prototype that you can use to extract a section of a array. Let’s say you want to remove the first two elements from a array.

Read more

Webpack: introduction without any code.

There have existed build tools for JavaScript as long as I have been coding with it. I can without doubt say that they are better and easier to understand today than they have ever been. But there are also much more you “need” to know before you get started.

Read more

Looping without loops.

As a coder or an aspiring one you have probably experienced many moments where all the smokes blows away and you understand something much clearer. One of these moments for me was when I was introduced to recursion. Probably, while learning Scheme or Haskell.

Read more

What’s the difference between JavaScript and ECMAScript?

I’ve tried googling “the difference between JavaScript and ECMAScript.”

I ended up having to wade through a sea of ambiguous and seemingly conflicting results:

“ECMAScript is a standard.”

“JavaScript is a standard.”

“ECMAScript is a specification.”

“JavaScript is an implementation of the ECMAScript standard.”

“ECMAScript is standardized JavaScript.”

Read more

Javascript: What Are Template Literals?

ES6 introduced two types of literals: Template Literals and Tagged Template Literals to tag Template Literals. In this post, we cover both of them in depth!

In ES6, two types of literals were introduced:

  1. Template Literals for string concatenation and expression embedding in a string
  2. Tagged Template Literals to tag the Template Literal in a function so the literal can be evaluated in the function

Read more

Event Capturing and Bubbling in JavaScript

The DOM has two approaches for object to sense events: first is top down approach and second is bottom up approach. Top down approach is called event capturing whereas bottom up is known as event bubbling.

Read more

JavaScript: Why does 3 + true = 4? (and 7 other tricky equations)

How to Follow Along

It’s about to get weird — and you’re going to want to follow along with me. You can open up your Chrome Developer Console with: (Windows: Ctrl + Shift + J)(Mac: Cmd + Option + J). This will allow you to type all of the following code into your browser so you can see in real time what is happening…

3 + true == 4

I’m not kidding either. In JavaScript, when the plus operator is placed between a number and a boolean, the boolean is converted to a number.

Read more

ECMAScript5 Strict Mode, JSON, and More….

Introduction

There are a number of other new features and APIs that need attention, as well. The largest of which are Strict Mode and native JSON support.

Strict Mode

Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “strict” operating context. This strict context prevents certain actions from being taken and throws more exceptions (generally providing the user with more information and a tapered-down coding experience).

Read more