Count() Method in Javascript