javascript-300x120

What are ES6 generators useful for?

Easily one of the weirder new constructs within the new ES6 spec, the ES6 generator answers a perplexing question: What would happen if you stopped a loop in the middle of its execution, went off and did something else for a while, then came back? It turns out that you can actually do quite a bit. […]

1024px-Flatirons_Winter_Sunrise_edit_2

Using JavaScript forEach to do Array Looping and Iterations

This tutorial demonstrates using the Array.forEach() method with some examples. forEach() is designed to run a function on each indexed element in an array. Starting at index[0] a function will get called on index[0], index[1], index[2], etc… forEach() will let you loop through an array in much the same way as a for loop. Let’s […]

javascript logo

Using the JavaScript ParseInt Method

JavaScript’s parseInt function is all about converting a string to an integer. The function takes a string value as an argument and converts it to a numerical value with no decimal places, or alternatively the value NaN. ParseInt has a total of two parameters and thus takes two arguments. The second parameter specifies a radix […]

javascript logo

How to Reload a Page in JavaScript?

Refreshing or reloading a web page in JavaScript isn’t all that difficult. There is the straightforward window.location.reload (or just location.reload) method, and then there are a few less intuitive approaches that achieve the same effect. In the this lesson, I’ll show two examples of how to reload a web page using JavaScript. Get ready to get […]

javascript logo

Using the JavaScript Apply Method

Functions are one of JavaScript’s most powerful features. Functions in JavaScript allow programmers to create dynamic input/output systems, code more efficiently, and they allow for management of scope. Next to objects, functions in JavaScript may be the single most important feature of the entire language! Explore JavaScript Courses Functions in JavaScript are special because they […]

photo-1453060113865-968cea1ad53a

Ng-if Examples, Use Cases, and Caveats

Ng-if is a built-in Angular directive for adding and removing content from the DOM. Ng-if is extremely handy for showing and hiding buttons, links, text, images, or other types of content on a page. We covered the differences between ng-show, ng-hide, and ng-if here, so this post will focus specifically on ng-if syntax, examples, and […]

Utah_array_pat5215088

An Array of JavaScript Array Methods

JavaScript Array Methods Table of Contents: Avoiding the Index Prepositional Soup: From In to Of The Joy of Higher Order Functions How Do Your Arrays Stack Up? Pop! It is no real surprise that one of the primary purposes of computer languages is processing lists (indeed, one of the oldest programming languages – Lisp – is […]

angular

angular.bootstrap Explained in 3 Examples

By default, an Angular application is initialized automatically by loading the angular.js script and placing the ng-app directive to the root element of your application (e.g. <html> tag), like the following:

Explore Angular Courses Alternatively, you can also initialize your application manually if you need, using the angular.bootstrap() function. This is especially useful when […]

javascript logo

Insert, Remove, and Replace elements with Array.splice()

When you already have an existing array and need to make some edits, the Array.splice() method comes in handy. The splice() method allows you to INSERT, REMOVE, and REPLACE elements from a javascript array. Before jumping into any examples, let’s start by taking a look at the arguments passed into the splice() method. Array.splice(start_index, number_of_elements_to_remove); […]

javascript logo

Learn JavaScript Basics: Basic Features

Variables Variables are a means for holding on to or pointing to specific values. In JavaScript, variables are declared by using the var keyword and a valid variable name (the var keyword only needs to be used when first declaring a variable). A variable holding a numerical value might look like this:

A variable […]