removing trailing commas from js