Not sure if I'm missing something, but wouldn't it be trivial to code that
constructor in JS?
```js
class Result {
constructor (type, value=true) {
this[type] = value;
}
}
function add(data) {
if (data !== Object(data)) {
return new Result('error', new Error('The data is not an
Object literals (object initializers) are just a convenient way to create a new
ordinary object which (initially) inherits from `Object.prototype`, and
populate it with some properties.
I don't think you should be able to distinguish them from similar objects not
created using object
In my opinion it's a bit incoherent that each object-coercible type behaves
differently when coercing symbols to it.
Symbols can be explicitly coerced to strings, but not implicitly:
```js
String(Symbol("abc")); // "Symbol(abc)"
Symbol("abc") + ""; // TypeError
```
Symbols can't be coerced to
> ECMAScript, while highly used in web browsers, should really not care about
> HTML constructs. That's where WHATWG and W3C come in. I suggest this type of
> feature should come from one of those groups, not ECMA.
That applies to escaping things like `` or `]]>`, and I agree. But as
Mike
I disagree with silently ignoring property access on null/undefined.
> Early errors are nice
Yes, exactly. Errors should fail early and loudly. That's why the strictness of
strict mode is useful.
> It's no weirder that `123.foo` not throwing.
No, it's entirely different, because numbers
> Create a callable-only function that calls its left operand with the original
> arguments and `this`, then calling its right operand with the result and the
> same `this`.
IMHO, the order seems wrong. Not sure if programming languages do it
differently, but in math composition works like
> So if all my code is in strict mode, and I get a non-strict code function to
> shadow as Tom and I were talking about in another thread... how do I even
> test for that if my code is either consistently strict or consistently
> non-strict?
Don't check that. The target could have other
> Mozilla's approach violates ECMAScript's forbidden extensions and can't be
> considered "correct"
Why? The spec forbids adding "caller" or "arguments" in strict mode. I think it
does not enforce adding them in sloppy mode.
Chrome seems to add them only in sloppy mode, and Firefox to never
> Could there be a Proxy.hasBeenRevoked(proxy) method?
The Proxy constructor only accepts targets and handlers when they are objects
and are not revoked proxies.
I wonder what's the point of not allowing revoked proxies but allow revocable
proxies which may be revoked later.
Anyways, this
Probably, because symbols are primitive values, and constructors only create
and initialize objects.
So you are supposed to call it as a function instead of as a a constructor.
That said, it might make sense for `new Symbol()` to return a symbol object.
But instead, you can use
> There are no items in `[]` so that doesn't seem like a true statement to me.
It's true by [Vacuous_truth](https://en.wikipedia.org/wiki/Vacuous_truth).
> So, at least consistency pulls towards `false`.
You are misunderstanding what `includes` does when there is no argument.
```js
What's the point of using `reduce` instead of `every`?
```js
Array.prototype.includesAll = function (...args) {
return args.every(item => this.includes(item));
}
```
I disagree with this test
```js
expect([2, 3].includesAll()).toBe(false)
```
The array `[2,3]` includes all items in `[]`. So
Array.prototype.includes uses the second argument as the starting index.
Therefore, these calls would be identical, but you want them to behave
differently:
```
["a"].includes("a", 0); // true -- "a" can be found at position 0
["a"].includes(...["a", 0]); // false -- 0 can't be found in the
I agree with Bergi.
> Brendan Eich and think he understood that fairly
I can't see that. He says things like "what's to propose?", "what is declare? I
don't think core language needs to grow", "What does this have to do with
promises?", "I don't see the point" and "It's not making sense,
As Isiah Meadows said, you can just use variables.
```
var removeNode = true;
control.dispose(removeNode);
```
```
var silent = true,
disableValidation = true,
destroyOldValue = false;
model.set('foo', newValue, {silent, disableValidation, destroyOldValue});```
From:
`setTimeout` is not part of ECMAScript. You should suggest this to WHATWG
instead.
- Oriol
From: m...@adriansieber.com
Date: Mon, 25 Apr 2016 17:35:50 +
Subject: Proposal: Switch position of delay and callback in signature of
`setTimeout()`
To: es-discuss@mozilla.org
Everytime I
They are no necessary the same:
```js
var _Object = window.Object,
Object = function() {};
class Foo1 {
constructor() {}
}
class Foo2 extends Object {
constructor() { super(); }
}
_Object.getPrototypeOf(Foo1.prototype); // _Object.prototype
_Object.getPrototypeOf(Foo2.prototype); //
Consider this code:
```html
let {foo} = null; // TypeError
// Here I want to assign some some value to foo
```
The first script attempts to let-declare `foo` via a destructuring assignment.
However, `null` can't be destructured, so the assignment throws a TypeError.
Some alternatives which
18 matches
Mail list logo