These practices revolves around the pragmatic approach to JavaScript coding which deals with practical usage rather than theoretical considerations.
"use strict"
is a language construct that tells the compiler how to interpret the document. If you are familiar with html doctype or character encoding, they serve similar purposes.
- it works
- it's easy to understand
- it should be easy to do
- Use long, descriptive variable and method names
var bindAllButtons = function() { /**/ },
redirectURL = 'http://www.isobarhub.com',
redirectButtonClass = '.button--redirect';
Encapsulation includes the idea that the data of an object should not be directly exposed. Instead, callers that want to achieve a given result are coaxed into proper usage by invoking methods (rather than accessing the data directly).
var person = {
"fullName": "Jubal Mabaquiao"
}
alert(person.fullName); // Jubal Mabaquiao
person.fullName = "Juan Dela Cruz"
alert(person.fullName); // Juan Dela Cruz