Xah Web Dev Blog Archive 2015-09

JavaScript quiz of the day. true or false?

function f () {};
Function.prototype = 3;
console.log( f instanceof Function );

refresh here JS: “instanceof” Operator, but that still may not answer why.

puzzling? discuss at https://plus.google.com/+XahLee/posts/CLMxi9LGteG

Solution

this will silently fail.

// silently fail
Function.prototype = 3;

If you add "use strict", then error is reported.

"use strict";
Function.prototype = 3;

// Function.prototype = 3;
//                    ^
// TypeError: Cannot assign to read only property 'prototype' of function Function() { [native code] }

You cannot change Function.prototype, because the “prototype” property there does not have “writable” attribute.

console.log(
    Object.getOwnPropertyDescriptor(Function,"prototype")
);

// output:
// { value: [Function: Empty],
//   writable: false,
//   enumerable: false,
//   configurable: false }

JS: Property Attributes

HTML Input Range: Slider UI

JS: SVG Clock (updated. Using svg transform instead for moving the hands.) [see SVG: Coordinate Transformation]

get local copy of html5 spec

the whatwg group finally made building their html5 spec simple. git and build your own for local reading. https://github.com/whatwg/html-build

SVG Path: Elliptical Arc (new)

emacs google plus girl profile spam 2015-09-24 47415
Pretty Girl Spam

now i succumb to the tyranny of JSDoc. http://usejsdoc.org/

JS: Should You Move Variables to the Top? (updated.)

How to Disable JavaScript, Flash, Java in Google Chrome, Firefox, Internet Explorer (repost)

JS: Function Call, Apply, Bind (major rewrite)

JS: Get Max/Min Value of Array (on its own page)

Web Spam, Scam, Blackhat SEO Collection

CSS: What's a CSS Pixel? What's Reference Pixel? (rewritten)