Just playing around with the spread operator and I found a neat little design pattern I think I am going to work in:

`1 2 3 4 5 6 7 8 910111213141516`
`let testArr = [9,1, 2, 6, 3, 4];const newMax = (arr) => {  if(arr.length === 1) { return console.log('end')};  var [a, ...arr] = arr;  let max = Math.max(a,...arr);  console.log(max ,' >=', ...arr);  newMax(arr);}newMax(testArr);//output9 ' >=' 1 2 6 3 46 ' >=' 2 6 3 46 ' >=' 6 3 46 ' >=' 3 44 ' >=' 4end`

Seems a fun way to look for edges like in the water trap toy problem? I am not sure, but it will be fun to play around with it.

Another thing that used to annoy me was how you had to use string concatenation. It just looked so ugly. I finally (okay I am late to the party) started using backticks for multi-line parties!

`12345678`
`var motion = `Le mouvement de lacet sur la berge des chutes du fleuve,Le gouffre à l’étambot,La célérité de la rampe,L’énorme passade du courantMènent par les lumières inouïesEt la nouveauté chimiqueLe voyageurs entourés des trombes du valEt du strom.``

And finally a little more fun with the spread operator (thanks Alex Rauschmayer) but you can make an array only contain unique values in a very clean, native way.

`1234`
`const arr = [7, 3, 1, 3, 3, 7];[...new Set(arr)]//returns[ 7, 3, 1 ]`

Originally published on Wordpress

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.