Yahoo interview question

convert data in javascript