27

devrantUsers.map(user => `Hello ${user.userName}`).join(', ');

Comments
  • 10
    Hi!
    I wanted to say hello with a line I write every day in some form.

    I lurked about 2 months here and finally decided to create an account. Already feeling warm and cozy here :)

    Hopefully, it does not lower my productivity to much, we have a project to deliver prior christmas...
  • 7
    Welcome :)

    Sidenot: You don't need to make a join(','). The Array.prototype.toString already does that ;)
  • 4
    Yeah, I first wanted to .join('\n') but changed it to ', ' later.

    Normally, I do not use the join at all, because the return element would be wrapped in some React tags and thus no string anymore.
  • 4
    Welcome to devRant
  • 3
    devrantUsers.map(u=>`Hello ${u.userName}`).join`, `

    i just had to do some golfing...
  • 5
    const sayHello = compose(
    join(),
    map(compose(
    concat('Hello '),
    get('username')
    ))
    );

    sayHello(devrantUsers);
Add Comment