Finding Index Of Element In List Javascript