News for hackers. Stuff that matters.
Re:Show HN: Learn and practice modern JavaScript by ivan_ah on Thursday January 03, 2019 @10:53AM (#18815994)
Here is a language diff that shows when new language features added to Firefox. This might be helpful to get an exhaustive list of the changes: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_...

In practice the only thing you absolutely need to know is the spread syntax for arrays `blist=[...alist]` and objects `objb={...obja}` that will trick you up if you're never seen in before

   alist = [1,2,3]
   blist = [...alist, 4]   // == [ 1, 2, 3, 4 ]

   obj =  { a: 5, b: 6 }
   obj2 = { ...obj, c:7 }  // == { a: 5, b: 6, c: 7 }
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

There is also this weird shortcut for creating objects for which key and value use the same identifier:

   d=8
   e=9
   obj = { d, e }   // shorthand for {d:d, e:e}
   // == { d: 8, e: 9 }
Re:Show HN: Learn and practice modern JavaScript by arethuza on Thursday January 03, 2019 @10:54AM (#18816006)
I wouldn't say that latter thing is a "weird shortcut" - C# has had that for a while and I rather like it. :-)