[javascript] How to check if array element exists or not in javascript?