extend an array – js way  [ 760 views ]

Goal: find the cleanest way to extend an array

Everyday happening to extend an array in javascript. There are many ways to do but here is the simplest one 🙂

var myArray = [1,2,3];

// extend this is easy
myArray = [...myArray, 4, 5, 6];

No more code, no more pain in the neck just an extended array. What we need more for today?

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }