Javascript Array And String Methods In Apex