Bubble Foundry


Posts tagged with: arrays

regexInArray
Javascript arrays have an inArray() method that tests for the existence of a search object and returns its key. However, sometimes you don’t want to test for an exact match. I wrote a little function that will test a regex instead. Like inArray() it returns -1 if none of the elements satisfy the condition. function […] Read more – ‘regexInArray’.
BFCollections
I’ve been doing a bunch of PHP programming the last few weeks for a client and it’s been such a pain to use PHP’s archaic array_* methods. And don’t get me started on having to return arrays like array('result' => 'not_ok', 'message' => 'User not found') to indicate success or failure. I had some time […] Read more – ‘BFCollections’.
A Subtle Javascript Mistake
I was just pounding my head against what turned out to be a simple Javascript misconception that I hope I can save people from: in tests for the existance of a key, not a value, in an object or array. So the following work: var myObj = {1: "one", 2: "two"} 1 in myObj // […] Read more – ‘A Subtle Javascript Mistake’.