Xah Web Dev Blog Archive 2015-07

JS: “this” Binding (major update. Added a section on the purpose)

JS: Array Compare Equality

JS: Range Function for Array

JS: 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

JavaScript Execution Order (minor update)

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.

JS: Deferred Loading JavaScript for Old Browser (minor update)

Google's PageSpeed Insights Fails Its Own Site

why JavaScript object hierarchy is confusing
why JavaScript object hierarchy is confusing

JS: Prototype and Inheritance

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;
}

JS: ECMAScript 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

JavaScript, in ES6, the term “host object” is gone.

JavaScript, in ES6, the term “native object” is now called “standard” object.

compare:

JavaScript object tree
JS: Prototype and Inheritance

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

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

answer: JS: Access Property, List Properties

JS: Get Property, Set Property (new. on its own page)

JS: Create/Delete Property (new. on its own page)

JS: Property Overview (new)

JavaScript quiz: property name with space

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

JS: Property Dot Notation / Bracket Notation

JS: Prototype and Inheritance (major update. Added standard object inheritance hierarchy. A picture is coming.)

Javascript Style Guide

JavaScript object's __proto__ property for getting parent is now officially blessed by ES 6. JS: Find Object's Prototype

in ECMAScript 6, the confusing terminology “internal property”, is now called “internal slot”.

see ECMAScript Data Types and Values#sec-object-internal-methods-and-internal-slots

Like what you read? Buy JavaScript in Depth