Getting back on track and coding

This is learning diary post from Uni Helsinki course Software Factory / Facebook academy – SocketIO team. For more info about this course read  “Ready, Set, Start Coding!”.

You can find open issues and questions I collect from past week in my quick project notes.

 Yep, where were we?

It’s been a long while since the last time I did put some hours into this project so now it’s time to get back on track.

The difference global variables in browser

var foo = ‘bar’;
console.log( delete );  // false, not deleted

Creates a variable on the variable object on the global execution context and which is the global object that on browsers is aliased as window. This creates a property on window that you cannot delete and it is also defined before the first line of code runs.

The window symbol itself, is a actually a property of the global object that it uses to point itself.  Note also that on IE8 and earlier the property created on window is not enumerable, in IE9 Chrome, Firefox and Opera it is.

foo = ‘bar’;

Creates a property on the window object implicitly. As it’s normal property and it can be deleted. = ‘bar’;

Creates a property on the window object explicitly. It’s a normal property and can be deleted. = ‘bar’;

Keyword this  in the global execution context references the global object, so the code is identical to case above it.

Be aware with with global variables they can be confusing
foo = ‘bar’;

function doFoo() {
foo = “Hello”; // overides global variable

function doBar(foo) {
console.log(foo) // does this print “Hello” or “Howdy”


but avoid cluttering the global object

the best practice is to creating a namespace variable, that you use for the needed properties.

var app = {}; = ‘bar’;

 Next this on the -team.

During the weekend I have time to write about the architecture in project.