Sunday, 8 September 2013

Javascript Object increment item if not exist

Javascript Object increment item if not exist

Is there a standard way to do this? I know how in Python but in Javascript
whats the best way to add a key to a dictionary by first checking if the
key already exists, if not, add it with a value of 1, if it DOES exist
then just increment the current count.

No comments:

Post a Comment