Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28863

Re: is there a function enumerating all element in an object?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: is there a function enumerating all element in an object?
Date Thu, 29 Oct 2015 20:49:25 +0000
Organization A noiseless patient Spider
Lines 36
Message-ID <87ziz1flii.fsf@bsb.me.uk> (permalink)
References <7cb49130-72c4-48ee-b968-60a5e7648855@googlegroups.com> <f26e3952-78f4-49cd-ad94-2a451530fd17@googlegroups.com> <n0tmpr$ia$1@speranza.aioe.org> <n0to0e$3im$1@speranza.aioe.org> <XnsA542D564FBADCeejj99@194.109.6.166>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="10422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/k+MexyI6IlAMrCLiFwT3sXACqPNWblKg="
Cancel-Lock sha1:nMkzTN3FM/2YiEFDnzDylnVnliA= sha1:R2J7CQDjgZoXTLA2kfA/Gd174wM=
X-BSB-Auth 1.263035ec2cfc0dd2a898.20151029204925GMT.87ziz1flii.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:28863

Show key headers only | View raw


"Evertjan." <exxjxw.hannivoort@inter.nl.net> writes:

> Joao Rodrigues <groups_jr-1@yahoo.com.br> wrote on 29 Oct 2015 in 
> comp.lang.javascript:
>
>>> Object.keys(obj).map(key => callback(key, obj[key]));
>> Or:
>> 
>> Array.from(Object.keys(obj), key => callback(key, obj[key]));
>
> Could you please explain to us simple minded how this realy works?

In ES6, the form

  x => expression

is similar to

  function (x) { return expression; }

There are a few differences ("this" is lexical in an arrow function and
there is no "arguments" object) but neither of those matter here I don't
think.

[You may have multiple parameters:

  (a, b) => a + b

and you may have an explicit block rather than a single expression:

  x => { console.log(`x = ${x}`); return x; }

which sneaks in another ES6 feature: template strings.]

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

is there a function enumerating all element in an object? Stone Zhong <stone.zhong@gmail.com> - 2015-08-21 22:44 -0700
  Re: is there a function enumerating all element in an object? nathank887@gmail.com - 2015-10-28 22:11 -0700
    Re: is there a function enumerating all element in an object? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-10-29 15:59 -0200
      Re: is there a function enumerating all element in an object? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-10-29 16:20 -0200
        Re: is there a function enumerating all element in an object? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-10-29 20:58 +0100
          Re: is there a function enumerating all element in an object? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-29 20:49 +0000
            Re: is there a function enumerating all element in an object? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-10-29 22:49 +0100
              Re: is there a function enumerating all element in an object? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-10-30 16:05 -0200
              Re: is there a function enumerating all element in an object? RobG <rgqld@iinet.net.au> - 2015-11-14 13:16 -0800
                Re: is there a function enumerating all element in an object? Chuck Anderson <seemysig@thisis.invalid> - 2015-11-14 17:58 -0700
                Re: is there a function enumerating all element in an object? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-11-16 14:26 -0200
  Re: is there a function enumerating all element in an object? donmaximo01@gmail.com - 2015-10-29 06:08 -0700

csiph-web