Xah's Web Dev Blog Archive 2013-11

CSS Selector Syntax (new syntax coloring)

much improved syntax coloring on the whole site. For example, see: JavaScript Array Methods

JavaScript: paren optional in x=new F()x=new F. JavaScript: What Does Keyword 「new」 Do?

possibly i'll have a first phone interview with Google engineers. The human resource asks me about googlers i know. Who can give a helping hand? thanks. (xahlee@gmail.com)

Javascript, Design Patterns, Software Engineering, Appoach to Computer Language Tutorials

JavaScript: Property, Prototype Chain, Enumerable: Accessing & Listing Properties

JavaScript: Checking Property Existence

JavaScript: Property Attributes: Writable, Enumerable, Configurable

spent the past 3 months studying JavaScript in depth. The following are entry points.

JavaScript object system is very different from Java or Python. So it takes some used to, yet it's rather much simpler than Class/Object based system. However, the language itself is a bit convoluted.

I'll be keep updating these pages in coming weeks. I hope you like it. If you do, help spread it. Thanks.

The grand finally. JavaScript Objects Tutorial: Understanding JavaScript Objects

JavaScript: Disallow Adding/Deleting/Writing Object Properties

What's Object in JavaScript?

JavaScript function has a .length property. Its value is the number of parameters declared in the function. see JavaScript: Defining Function with Optional Parameters/Arguments

JavaScript State of the Art, 1996

JavaScript: What Does the Keyword 「new」 Do Exactly?

JavaScript “instanceof” Operator

JavaScript Class Attribute

Internet Explorer  anime girl 96030
Internet Explorer Anime Girl

see more of her and a video of her fighting the bad guys at Internet Explorer Anime Girl

JavaScript: Using Map with Second Argument for Function's Object Context

Some array methods, such as array.map(f, o), takes a optional second argument o as the context object. That is, the object o becomes the value of this keyword in the function f. Here's a example:

// example of using map with a second object for function's context

var ff = function (x) {
    this[x.toString()] = x+1;   // add a property to the object this function is context of
    return x+1;
}

// new object
var oo = {};

// array
var a1 = [1,2,3];

// map ff to a1, with context oo
var a2 = a1.map(ff, oo);

// new array value
console.log(a2);                // [ 2, 3, 4 ]

// oo is changed
console.log(oo);                // { '1': 2, '2': 3, '3': 4 }

JavaScript Array Methods (updated)

How Much Can You Make by Blogging? the Ease of Professional Blogging (updated)

JavaScript: What's “this” Keyword?

JavaScript: How to Determine Strict Mode?

Example of JavaScript Sort Method Using Custom Predicate

// array sort example
var aa = ["a1", "a70", "a8", "A2"];

// default sort. element compared as string
aa.sort();
console.log(aa);                // [ 'A2', 'a1', 'a70', 'a8' ]

// sort by comparing as numbers after first char
aa.sort(ff);
console.log(aa);                // [ 'a1', 'A2', 'a8', 'a70' ]

function ff (x,y) {

    var nx = parseInt(x.slice(1)); // remove first char. consider rest as number
    var ny = parseInt(y.slice(1));

    if ( nx < ny ) { return -1; }
    if ( nx > ny ) { return 1; }
    if ( nx == ny ) { return 0; }
}

JavaScript Array Methods (updated)

Internet Explorer Anime Girl (oldie, on its own page)

HTML5 Audio Tag Tutorial (updated)

JavaScript Tutorial: Understanding Prototype and Inheritance

best Ruby book is David Flanagan's Ruby Programming Language and Best JavaScript book is his JavaScript Definitive Guide JavaScript & Ruby Books by David Flanagan, and the Man-made Complexity in Computer Language

JavaScript: What Are Getter and Setter Properties and How to Create/Use Them

blog comments powered by Disqus