-
Couldn't load subscription status.
- Fork 0
JavaScript
Discover JavaScript's true power using practical real world examples. Although this is a complete guide I have moved the basics of JavaScript to end of this guide. Why? Simple, because I see JavaScript as an ubiquitous language. Meaning that JavaScript has been around since the beginning of the Internet and most web designers/ developers have this basic knowledge and I don't want to repeat myself. So let's focus on the aspects that are great about JavaScript, and the not so great.
If you are a beginner with JavaScript you can still find all the basic information at the end of the guide. See Contents section below.
- mariz
- mariz
JavaScript despite what many programmers think is an Objective Oriented Language. In fact, everything in JavaScript is an Object. Objects are a collection of properties. Each property has a name and value pair. Values can be anything, from complex Objects or Functions to simple Strings.
Objects created using {} syntax.
var obj = {}; // empty object literalUsing the reserved keyword new followed by the built-in constructor called Object. Will create an object with no properties nor methods.
var obj = new Object();Using the reserved word Object is not the best way to create object using the constructor notation.
Functions in JavaScript are objects. With this in mind you can use this reserved word to create your own objects without have to use Object all the time. Ex.:
function Person(name,age){
this.name = name;
this.age = age;
}Note that we are using the reserved word this to define our properties name and age.
Dot notation
Brackets notation
hasOwnProperty
For In Loop
DRY
Functions that change properties values are called commands (Set methods) and functions that return values of properties are called queries (Get methods).
Fluent Interface is the ability of calling multiple methods.
//todo
by TagName
//todo
by ID
//todo
by Attributes (style, class, etc)
//todo
// todo