how to parse a string in javascript