5 minute code: JQuery Tabbed Interface

The JQuery UI library is awesome for doing super cool stuff super quick. For example, a tabbed interface! Who wants to reload after you click on a tab? No one. Who wants to take ages to code it? No one. Therefore, welcome to TGC’s 5 minutes of code! 1. Make the tab links.  Make sure...
Read More

Prototyping and Inheritance in Javascript

A prototype in Javascript is exactly what it sounds like: a prototype for object to follow.  The best way to explain it would be with an example, of course! We’ll throw in some inheritance while we’re at it. Let’s say we have an an Animal object, that has a name and numLegs, which is a...
Read More

Classes in Javascript

For all of those who usually code in OO languages, there’s actually a pretty similar approach in JS. A “class” in JS will have the properties / attributes of the object, along with any methods that might relate to that object. It’s like a template that can be used to create many objects with similar...
Read More

Objects in Javascript

Declaring an object in Javascript can be done in various ways. Object Literal Notation This creates a single object. Initiating an object with literal notation goes like this: var anne = { name: "Anne", age: 32 // adding functions speak: function () { // code; }; }; where the properties are given as a hash...
Read More