How to store input values in an array in javascript