Home » 2016 » February

Angular 2 – First Impressions [Compared to Angular 1]

I’ve spent the last week putting together a reference app for Angular 2.  It is a great exercise to try to nail down the basics of how a new framework works.  Next week I plan on doing a similar exercise for React.

Anyhow, I thought for this week’s post, I would try to relay some of my impressions, and some of the issues I see with this new framework.

Angular 2 - First Impressions

Continue reading “Angular 2 – First Impressions [Compared to Angular 1]”

JavaScript Functions — In-Depth

Last week I talked about JavaScript variables gotchas.  This week, we want to take an in-depth look at JavaScript functions.

Why?

Well, for the same reason we looked at variables last week.  If you keep using JavaScript the way you think it works instead of the way it really works, at best, you will have a much harder time debugging your JavaScript code.  Worse case, you introduce some pretty nasty bugs into your code.

So, let’s start with a pretty basic JavaScript function question.  One I would use as a question if I were interviewing someone for a hard core JavaScript job.

What is the difference between the following two ways of declaring a function?

function foo(){
}

var foo = function(){
}

JavaScript Functions -- In-depth
Continue reading “JavaScript Functions — In-Depth”

JavaScript Variable Gotchas

If you’ve been programming using JavaScript for any length of time, you’ve probably run into several of the JavaScript variable scope gotchas.  You may have even been able to fix them.  But you could prevent these gotchas if you understood better why the gotchas exist in the first place.

My goal, through a series of blog post on the topic, is to make us all better JavaScript programmers.  JavaScript is no longer a toy.  Those who survive in the new JavaScript eco system will be those who understand why JavaScript works the way it does.

I’m going to approach this topic as a series of puzzles.  This will show the issue and then we can discuss why the issue exist and what to do about it.

JavaScript Variable Gotchas

Continue reading “JavaScript Variable Gotchas”

JavaScript Unit Test Code Coverage Using NodeJS

A couple of weeks ago, I showed how to get Node.JS and Gulp working with Visual Studio 2015.  Last week I showed you how to bundle, minify, and cache-bust using Gulp.  This week, we are going to use Node.js to provide JavaScript Unit Test Code Coverage.

The main tools we will be using to pull this off are Karma and Istanbul.  The test we write will be using Jasmine.

If you don’t use Visual Studio, you should still be able to adapt these instructions to your own environment.  I’ve found getting Istanbul setup kind of tricky at times.  Since everything I’m going to show you here is pure Node.JS, you can ignore the Visual Studio parts.

Let’s get started.

JavaScript Unit Test Code Coverage Using NodeJS

Continue reading “JavaScript Unit Test Code Coverage Using NodeJS”