JavaScript - xchema/guidelines GitHub Wiki

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.

Contents

  1. mariz
  2. mariz

Functions

Functions

Function scope

Function literals

Callback

Closures

OOP

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.

Literal Notation

Objects created using {} syntax.

var obj = {}; // empty object literal

Constructor Notation

Using 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.

Creating your own constructors

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.

What is "this"?

Properties

Dot notation

Brackets notation

hasOwnProperty

For In Loop

Methods

Prototype

Inheritance

DRY

Gets and Sets (Commands and Query Separation)

Functions that change properties values are called commands (Set methods) and functions that return values of properties are called queries (Get methods).

Fluent Interfaces (Method Chaining)

Fluent Interface is the ability of calling multiple methods.

Promises

DOM

Finding elements

//todo

by TagName

//todo

by ID

//todo

by Attributes (style, class, etc)

//todo

jQuery

Sizzle

jQueryUI

jQueryMobile

qUnit

UnderscoreJS

BackboneJS

AngularJS

KnockoutJS

NodeJS

Templates

Express

Tests

Basics

// todo

References

⚠️ **GitHub.com Fallback** ⚠️