how to push both key and value into an array in javascript