ES6 Sampler #6 : Odds & Ends

December 08, 2016


JavaScript

Preface

There is a huge list of new stuff ES6 brings to the table, I’ve tried to cover a few of the most relevant things, but there are a ton of other new things, we’ll try covering a few more, the odds and ends in this final installment.

Pssst... Previous ES6 Samplers

Default Values

Challenge: Find out what default values are and how to use them, what is their equivalent in es5 ?

See the Pen ES6 Sampler #6 Odd & Ends - Default values by Eugenio Keno Leon (@k3no) on CodePen.

Object.assign

Challenge: Find out what object.assign does to an object, what does it replace in es5?

See the Pen ES6 Sampler #6 Odd & Ends - Object.assign() by Eugenio Keno Leon (@k3no) on CodePen.

Note: There are caveats and special cases when cloning/merging some objects, check this page for further Reading: Object.assign() MDN... As for es5, there are multiple ways of cloning and merging objects depending on what it is you are trying to achieve, check this 2 excellent posts for more:

Object Method & Properties Shorthands

Challenge: Find out the new shorthands for defining Object Properties in es6 and it's equivalent in es5

See the Pen ES6 Sampler #6 Odd & Ends - Object Properties shorthand by Eugenio Keno Leon (@k3no) on CodePen.

Challenge: Find out the new shorthands for defining Object Methods in es6 and it's equivalent in es5

See the Pen ES6 Sampler #6 Odd & Ends - Object Methods shorthand by Eugenio Keno Leon (@k3no) on CodePen.

Array find

Challenge: Find out how to use the array find & findIndex methods in es6 and their equivalents in es5

See the Pen ES6 Sampler #6 Odd & Ends - Array Find method by Eugenio Keno Leon (@k3no) on CodePen.

String Methods

Challenge: Find out how to use the new es6 string methods

See the Pen ES6 Sampler #6 Odd & Ends -String methods by Eugenio Keno Leon (@k3no) on CodePen.

And that’s it, a final sampler of some of the new things ES6 has to offer, now to start writing with them : )

Best,

Keno.