Chapter 2 - partial applications

by Denise Nepraunig

HTML

<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css">
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>
<div id="qunit"></div>
<div id="qunit-fixture"></div>

JavaScript

// Programming JavaScript Applications
// Chapter 3
// Objects

/* even primitive data types get treated as objects, when calling their prototpye methods! But be aware, you can't assign them new properties */

QUnit.test('domain extractor', function(assert) {
var domain = '[email protected]'.split('@')[1]; // => nepraunig.com
    assert.equal(domain, 'nepraunig.com', 'Extraction worked');
});
// Here the incredible singleton pattern
// just an object literal

var highlander = {
    name: 'McLeod',
    catchphrase: 'There can be only one.'
};