Change Css Class Property Dynamically Javascript Array Methods