Count Repeated Characters In Array Using Javascript For Navigation