Xah Web Dev Blog Archive 2015-07

this Binding (major update. Added a section on the purpose)

Test Array Equality

Range Function for Array πŸš€

Timing JavaScript Code

China ISP Ad Injection

Google gmail's spam box is now deciding what you should see. This from Linux Torvalds. https://plus.google.com/+LinusTorvalds/posts/DiG9qANf5PA

Google Gmail Blocks Mozilla Thunderbird

minor update JS: Load Order, defer, async, module

JavaScript Fun with new, null, null char, …

new;    // syntax error. keyword β€œnew” must be followed by a expression
x[new] = 22; // syntax error. keyword β€œnew” must be followed by a expression

x."new" = 11; // syntax error. dot notation can't start with quote
x.new = 7;    // valid. new is converted to a string

"\x00" // valid. a string with a null char.

var x = { null: 3 }; // valid. null is converted to string here
var x = { new: 2 };  // valid. new is converted to string here

var x = { "\x00": 4}; // valid. string with a null char, as property key

var x = { "p": null }; // valid. property value can be any value.

Deferred Loading JavaScript for Old Browser (minor update)

Google's PageSpeed Insights Fails Its Own Site

find nesting depth of a element

// find nesting depth of a element
function getDepth (ele) {
    var dp = 0;
    while ( ele.parentNode !== null ) {
        ele = ele.parentNode;
        dp++; }
    return dp;
}

2015 Features First draft.

ES2015 Language Specification – ECMA-262 6th Edition Now with collapsible table of contents.

Brendan Eich, inventor of JavaScript, turns out, is not a good presenter, nor is he a good blogger.

node.js size bloat
node.js size bloat

JS: Array-Like Object to Array (major update)

// js quiz. what does it return
 "toString" in {p:3}

answer: Access Property

Get Set Property (new. on its own page)

Create Property (new. on its own page)

Property Overview (new)

JavaScript quiz: property name with space

var x={"a b": 8};
x["a b"];
x[a b];
x."a b";

Property Dot Notation / Bracket Notation

Prototype and Inheritance (major update. Added standard object inheritance hierarchy.)

JavaScript Style Guide for Functional Programers

JavaScript object's __proto__ property for getting parent is now officially blessed by ES2015. Get Set Prototype