-
Notifications
You must be signed in to change notification settings - Fork 0
3.00 JavaScript
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc est ante, viverra et urna egestas, dictum mollis velit. Sed enim leo, varius id sagittis ac, interdum id lacus. Integer porta ac dui vel tincidunt. In non nibh congue, blandit diam at, rhoncus lacus. Suspendisse nec nunc vitae lectus malesuada finibus. Vestibulum eget enim et quam sagittis facilisis. Maecenas aliquet porta efficitur. Donec pretium ultricies ex, eu scelerisque nunc commodo ut. Maecenas porttitor facilisis dignissim.
One var
statement must be used per variable assignment. These must be declared at the top of the function in which they are being used.
// GOOD:
var string = 'Hello';
var int = 13;
var obj = {};
// GOOD:
var string = 'string';
var array = [
'monday', 'tuesday', 'friday'
];
// BAD:
var string = 'Hello';var int = 13;var obj = {};
All properties, functions and methods must use lowercase camelCase:
var myUsername = 'bill';
var dataArray = [
'Monday', 'Tuesday', 'Friday'
];
Constants must be uppercase with spaces delimited by underscores:
var env = {
PRODUCTION: 'production',
DEVELOPMENT: 'development',
TESTING: 'testing'
};
Comments should be used to explain anything that may be unclear when you return to it in six months time. Single line comments should be used for all inline comments that do not form part of the documentation.
// Export the function to either the exports or global object depending
// on the current environment. This can be either an AMD module, CommonJS
if (typeof module.define === 'function' && module.define.amd) {
module.define('broadcast', function () {
return Broadcast;
});
} else if (module.exports) {
module.exports = Broadcast;
} else {
module.Broadcast = Broadcast;
}
jQuery
$(el).hide();
IE8+
el.style.display = 'none';
jQuery
$(el).show();
IE8+
el.style.display = '';
jQuery
$(el).addClass(className);
IE8+
if (el.classList)
el.classList.add(className);
else
el.className += ' ' + className;
jQuery
$(el).remove();
IE8+
el.parentNode.removeChild(el);
If you want to see Others.
This wiki indexes libraries and resources available for JavaScript. In addition it provides some starting points for newbies in form of Beginner's Resources. In case you want to contribute, do take a look at Meta first for some extra pointers. Happy hacking!
IMPORTANT! jster.net is a spiritual successor of jswiki. There is more content but the site is less of a wiki. jswiki will remain here as more of a communal alternative. In addition you might want to check out the following:
- jsgamewiki
- Microjs
- JSDB
- JSPkg
- jQuery Plugin Registry
- Unheap - jQuery plugins
- JavascriptOO
- The Toolbox
- component.io
- Bower components
The following lists contain main categories of this site (sorted roughly based on page quality):