Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on ARM chips have an instruction with JavaScript in the name. Parent comment
var foo = { __proto__: null } foo.__proto__ undefined
> Also, `__proto__` is deprecated
Object.getPrototypeOf would be too verbose in this example. I could have defined
Object.defineProperty(Object.prototype, "proto", { get() { Object.getPrototypeOf(this) } })
> Primitive
> fn.bar = "abc"
is syntactic sugar for
fn["bar"] = "abc"
do not follow.
> (1).__proto__ === Number.prototype
number is primitive
typeof 1 "number" 1 instanceof Number false
Number.prototype.foo = function () { return this } 1..foo() //Number {1} typeof 1..foo() //"object" 1..foo() instanceof Number //true
typeof Math.max "function" Math.max instanceof Function true Math.max instanceof Object true
As I remember valueOf is complicated by hints, exposed in JavaScript [1]. I've played with removal
delete Array.prototype.toString delete Object.prototype.toString Uncaught TypeError: Cannot convert object to primitive value
delete Array.prototype.valueOf delete Object.prototype.valueOf +[] //0
There are no comments on this comment yet.
> Also, `__proto__` is deprecated
Object.getPrototypeOf would be too verbose in this example. I could have defined
but why bother? We both know that I meant [[Prototype]].> Primitive
> fn.bar = "abc"
is syntactic sugar for
fn["bar"] = "abc"
do not follow.
> (1).__proto__ === Number.prototype
number is primitive
number is wrapped in Number when we access property Function is not primitive it is an object, we can attach properties to object.As I remember valueOf is complicated by hints, exposed in JavaScript [1]. I've played with removal
Unfortunately it converts to string and than converts string to number. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...