Category Archives: JavaScript

Don’t create variables you don’t need

We were having a problem in our app where occasionally photos would load only partway. You’d see the top portion of the photo and the rest would be white. In testing, I was not seeing network errors. Nor was memory being exhausted. Listening in on the ImageView’s error event showed no errors being reported. It wasn’t… Read More »

Delete a member of an array

Here’s a quickie: Need to delete a member of an array in JavaScript? The traditional way is with the splice() method. Here’s an alternative using filter(): var deleteFromArray = function(array, valToRemove) { return array.filter(function(member) { return member !== valToRemove; }); }; Demonstrated in the JavaScript console: The filter() method examines each member of your array… Read More »