No need, just replace `this` with the passed parameter:
```javascript
function* keyValIterator (address) { for (let prop in address) { yield [
prop, address[prop] ]; } } var address = { street: '420 Paper St.', city:
'Wilmington', state: 'Delaware' }; for (let [ key, val ] of
keyValIterator(addres
e prototype chain are not an issue here.
>
> On Fri, Mar 4, 2016 at 1:04 PM, Edwin Reynoso wrote:
>
>> Sorry guys but this is very wrong, for in, loops through all properties
>> even the ones inherited from all prototypes, while Object.keys() and
>> Object.entries()
Sorry guys but this is very wrong, for in, loops through all properties
even the ones inherited from all prototypes, while Object.keys() and
Object.entries() do not. They are indeed very different
On Fri, Mar 4, 2016 at 1:45 PM Langdon wrote:
> Ahhh, nothing. I never think about destructuring.
tor in JS, even in this
>> dramatically simplified form.
>>
>> I don’t really expect that this proposal (with these gotchas) would be
>> able to reach consensus and make it into a ratified specification.
>>
>>
>> On Oct 26, 2015, at 6:21 PM, Edwin Rey
; `this` i guess, but I'm not sure if chaining a super method should lookup a
> method in the prototype first, or instance first
>
> On Oct 26, 2015, at 6:11 PM, Edwin Reynoso wrote:
>
> @CaitIin see what your saying which would simplify things:
>
> `foo()#` returns `undefin
@CaitIin see what your saying which would simplify things:
`foo()#` returns `undefined`
`foo.bar.call(baz)#` returns `foo` (correct?)
`baz.quux = foo.bind(bar)` returns `baz` (correct?)
and as for property accessors I think they should throw, it should only be
for function calls, because why afte
That's not possible @Eric
On Mon, Oct 26, 2015 at 2:20 AM, Eric Suen wrote:
> with
>
> obj.(doSomething(), doSomething2());
>
> you don’t need to introduce new operator.
>
>
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.moz
}.foo#` return? (a data property) (throw? the
> object? undefined?)
>
> On Sun, Oct 25, 2015 at 9:25 PM, Edwin Reynoso wrote:
>
>> Could we get a way to basically to get the object back from after a
>> method was called, so that instead of this:
>>
>> ```JS
>>
Could we get a way to basically to get the object back from after a method
was called, so that instead of this:
```JS
let obj = {
doSomething() {
// some side effect
return 5;
},
doSomething2() {
// some other side effect
return {x: 5};
}
}
obj.doSomething();
obj.doSomething2();
`
This seems to be the same thing I posted before as [String.substitute()](
https://esdiscuss.org/topic/string-substitute) I guess I didn't explain
correctly, but ayy I'm glad you guys are discussing this.
On Tue, Sep 15, 2015 at 10:39 AM, Claude Pache
wrote:
>
> Le 15 sept. 2015 à 14:02, Herby Vo
ch seems to be what you are
> trying to avoid.
>
> On Wed, Aug 12, 2015 at 8:19 AM, Edwin Reynoso wrote:
>
>> @logan that's an interesting thought, which is why I posted this for
>> discussion, Thinking of that, I'm kind of doubting most will like the
>
yourself. You may ask what's wrong with that?
Well then I'd say what's the point of `ES6` having `"Hi".includes("H")`
when we could of just did:
```JS
function includes(str, included) {
return str.indexOf(included) > -1;
}
```
On Wed, Aug 12, 2015 at 11:08
= 'This is year
> 2015'
> ```
>
>
> On Wed, Aug 12, 2015 at 4:42 PM, Nathaniel Higgins wrote:
>
>> Am I being naive or could this just be written in user space?
>>
>> Sent from my iPhone
>>
>> On 12 Aug 2015, at 15:31, Edwin Reynoso
x27;m ${age} yrs old`;
```
Compare to:
```JS
let yearSentence = String.substitute({ year: 2015}, `This year is ${year}`);
let ageSentence = String.substitute({ age:100 }, `I'm ${age} yrs old`);
```
On Wed, Aug 12, 2015 at 10:19 AM, Claude Pache
wrote:
>
> > Le 12 août 2015 à
Could we make the following possible, I can't seem to think of a way to do
it, since template literals are evaluated with the current scope, also
tried with `eval` but shouldn't even use that at all:
```JS
String.substitute( { year: 2015 }, `This year is ${year}` ); // Returns
"This year is 2015"
does it determine that unless again this is special to Arrays?? because
`b/index` could be anything else, that's not obvious compare to
destructuring.
On Tue, Jul 14, 2015 at 12:13 AM, Edwin Reynoso wrote:
> So I'm assuming this would be special to arrays??
>
> because dest
So I'm assuming this would be special to arrays??
because destructuring works fine for anything that's iterable:
meaning how would it know what to take out for Sets??
```JS
for(let value, index of [1,2]) {
// do something
}
```
With destructuring we at least know what's being extracted (not su
I'm highly doubting something like this will be made just because of
wanting to use the same variable name. What's the real use, besides more
code than using a different variable name.
On Thu, Jun 25, 2015 at 6:46 PM, Jordan Harband wrote:
> What would happen if this operator was used in the glo
```JS
var {f: foo} = {f: 5};
foo == 5 // true
```
On Sun, Jun 21, 2015 at 8:50 PM, Salehen Rahman
wrote:
> I know that `import` allows us to alias imports, like so:
>
> ```javascript
> import { f as foo } from 'f';
> ```
>
> But what about object destructuring assignments?
>
> ```javascript
> va
Wow Bob that's really neat. I really like it. Because it returns an object
instead of assigning like destructuring. So it's very useful. So LGTM now
as I kept reading I got a little confused, just give me a moment I will.
But +1 for me. :)
On Sat, Jun 20, 2015 at 12:30 AM, Bob Myers wrote:
> In
The only thing I don't like is the fact it's mixed with what's on
discourse.specifiction.org. I post more on discourse.specifiction.org than
on ES-Discuss, meaning I'm more comfortable bothering the people with my
ideas there than on ES-Discuss.
Plainly because it's not always ES related. ES-Discu
OMG Yes please!!!
On Fri, Jun 19, 2015 at 5:04 PM, Axel Rauschmayer wrote:
> http://discourse.specifiction.org/t/upcoming-migration/805
>
> Would it make sense to move es-discuss to that upcoming site? I’m not
> particularly fond of mailing lists and much prefer forums, especially
> discourse-ba
Yes please edit it, you don't have to repost. BTW the only thing I can
agree with is the `Object.is()` which to me seems like the only problem it
solves is `Object.is(NaN, NaN)` now returns true
On Fri, Jun 12, 2015 at 7:11 PM, Kevin Smith wrote:
> https://i.imgflip.com/mtot6.jpg
>
> On Fri, Jun
Proxy([new Person('Edwin', 'Reynoso', 16), new
Person('That', 'Guy', 1000)], {
get(target, property) {
if(target[property] !== undefined) return target[property];
var arr = [];
for(var person of target) {
if(person[property].constructor === Function) {
retu
n't get an `Error` saying that `Reflect`
is not defined I got:
`TypeError: people.logFullName is not a function`
So I don't think that worked.
On Tue, Jun 9, 2015 at 3:39 AM, Claude Pache wrote:
>
> Le 9 juin 2015 à 07:58, Edwin Reynoso a écrit :
>
>
> **Or does so
Let's say we have the following code:
```
class Person {
constructor(fName, lName) {
this.firstName = fName;
this.lastName = lName;
}
logFullName() {
console.log(this.firstName, this.lastName);
}
}
var people = new Proxy([new Person('Edwin', 'Reynoso'), new Person(
Lol "you" don't see the advantages, yet most do (including me). Why
wouldn't we improve the language itself. So just leave the language alone
like that, and let's focus on using plugins for other languages to work??
really?? and then we'll have to put in work into updating and fixing bugs
on those
Don't you just mean:
```
function addWithType(a=0, b=0) {
return int64(a) + int64(b);
}
```
On Mon, May 18, 2015 at 2:16 PM, Benjamin Gruenaum
wrote:
> What about non-default parameters?
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> h
Give it time, people don't check this everyday, and if they do. Wait till
they come up with an answer, also today's mother's day. Ik it's been 3 days
but again people don't check this everyday. I for one don't know the answer
to this.
___
es-discuss maili
:
>
>
> On Tue, Mar 24, 2015 at 7:09 PM Edwin Reynoso wrote:
>
>> For different objects this is the only way I see possible with
>> destructuring. IMO it's a bit ugly and weird to read deep destructuring:
>>
>> ```
>> let x = { a: 1
For different objects this is the only way I see possible with
destructuring. IMO it's a bit ugly and weird to read deep destructuring:
```
let x = { a: 1 };
let y = { b: 2 };
let { x: { a }, y: { b } } = { x, y };
```
But I'd prefer Bob Myers's way:
```
let x = { a: 1 };
let y = { b: 2 };
{x.a,
Well the current ES6 `.includes()` was before named `.contains()`:
[String.prototype.includes] (
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#String.prototype.contains
)
But if Garrett Smith was trying to point out that `.contains()` would be
bet
There are times where I would like to check whether a string has every
occurrence of certain strings/numbers:
```
var str = "John, Mary, Bob, Steve";
str.includes(["Mary", "Bob"]); // true
var str2 = "John, Mary, Steve";
str2.includes(["Mary", "Bob"]); // false
```
So the way the above would
33 matches
Mail list logo