Merging arrays is a fairly common occurrence. I remember when I worked a lot with PHP I would use
array_merge() all the time. I found myself merging arrays often when handling form submission.
concat may mess up a reference. If you want to merge a second array into an existing first array, you can use this trick:
var array1 = [1, 2, 3];
var array2 = [4, 5, 6];
console.log(array1); // is: [1, 2, 3, 4, 5, 6]
push in this case, allows you to merge the second array into the first. The alternative is iterating through the second array and using
push on the first array. This shortcut is niiiiiiiiiice!
attachEvent. Times have changed but there are still a few functions each developer should...
David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...
"Copy to clipboard" functionality is something we all use dozens of times daily but the client side API around it has always been lacking; some older APIs and browser implementations required a scary "are you sure?"-style dialog before the content would be copied to clipboard -- not great for...
-webkit-touch-callout CSS property, which prevents iOS's link dialog menu when you tap and hold a clickable element. The
click actions from doing...