Javascript – Testing

Testing There is certainly no shortage of tools to choose from when testing your JavaScript, and the list seems to grow longer each day. One of the more popular behavior-driven tools is Jasmine. In Jasmine you use a describe function to create a test suite, but you’re really just creating a JavaScript function. Inside of that function, […]

Javascript – Server Side JS

Implementation As Wikipedia states: “Node.js is a packaged compilation of Google’s V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript.” Beyond that, it’s worth noting that Ryan Dahl, the creator of Node.js, was aiming to create real-time websites with push capability, “inspired by applications like Gmail”. […]

Javascript – Asynchronous Programming

Apart from a few legacy bits that linger like the alert() function above, JavaScript is an asynchronous language.  When an event fires, all that happens is a new message is added to the queue. No event has the ability to take over the thread. Each event fired must get in the queue and wait its turn to […]

Javascript – Debugging and Error Handling

Before going into examples, let’s make sure that we know some basics. I highlighted four types of errors in JavaScript: Syntax errors occur at the interpretation time, they are considered as bugs and can never be handled properly because the code is just wrong by definition: 2. Program error, which is also a bug. For example, trying […]

Javascript – Browser and Events

Events, event handlers and propagation Events are actions or occurrences that happen in the system you are programming — the system produces (or “fires”) a signal of some kind when an event occurs, and also provides a mechanism by which some kind of action can be automatically taken (that is, some code running) when the […]

Javascript – Objects, Functions, and Classes

Objects Syntactically speaking, there are several ways to create an object in JavaScript. But no matter how you create an object, it’s actually abstracting an underlying API called Object.create().   Object Literal Notation Literal objects are great for one-off objects. But if you want to create two or more objects of the same type, they are […]

Javascript – Variables, Types, Collections

Variables, Types, and Collections Variables Keyword Scope Mutable Assignment var function yes let block yes const block no New variables in JavaScript are declared using one of three keywords: let, const, or var. JavaScript is case sensitive var is the most common declarative keyword. It does not have the restrictions that the other two keywords […]

A re-introduction to JavaScript

JavaScript has been with us for many many years now,  however it’s becoming more and more popular! There hundreds (maybe thoundsands?) of new frameworks that make it easier to build complex and user friendly web applications. We can find Single-Page applications everywhere and JavaScript is fundamental. I wanted to refresh my knowledge about it to […]