- jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
- Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
- AngularJS - Conventions based MVC framework for HTML5 apps.
- Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
- lawnchair - Key/value store adapter for indexdb, localStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof window.addEventListener === 'function') { // feature is supported, let's use it } else { // hmm, this feature is not supported, will have to think of another way } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>The with Keyword</title> | |
<script type="text/javascript"> | |
function book(title, author, publisher) { | |
this.title = title; | |
this.author = author; | |
this.publisher = publisher; | |
this.show = show; | |
} | |
function show() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>The with Keyword</title> | |
<script type="text/javascript"> | |
function book(title, author, publisher) { | |
this.title = title; | |
this.author = author; | |
this.publisher = publisher; | |
this.show = show; | |
} | |
function show() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Working with literal objects</title> | |
<script type="text/javascript"> | |
var soldier = { | |
name: undefined, | |
rank: "captain", | |
picture: "keeweeboy.jpg", | |
fallIn: function() { | |
alert("At attention, arms at the side, head and eyes forward."); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>functions</title> | |
<script type="text/javascript"> | |
function Distance(r, t) { | |
this.rate = r; | |
this.time = t; | |
this.calculate = function() { return r * t; } | |
} | |
</script> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>User-defined objects</title> | |
<script type="text/javascript"> | |
function Book(title, author, publisher) { | |
this.pagenumber = 0; | |
this.title = title; | |
this.author = author; | |
this.publisher = publisher; | |
this.uppage = pageForward; | |
this.backpage = pageBackward; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function Book() { | |
this.title = "The White Tiger"; | |
this.author = "Aravind Adiga"; | |
} | |
var bookObj = new Book; | |
alert(bookObj.title + " by " + bookObj.author); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>user-defined objects</title> | |
<script type="text/javascript"> | |
var toy = new Object(); | |
toy.name = "Lego"; | |
toy.color = "red"; | |
toy.shape = "rectangle"; | |
toy.display = printObject; | |
function printObject() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Cathc me if you Can!</title></head> | |
<body> | |
<script type="text/javascript"> | |
var age = eval(prompt("Enter your age:", "")); | |
try { | |
if(age > 120 || age < 0) { | |
throw "Error1"; | |
} else if(age == "") { | |
throw "Error2"; |
NewerOlder