I created a class in JavaScript like
function chat(data){
this.id = data.id;
this.name = data.name;
this.message = data.message
this.date = data.date;
}
Now i declare an array like this.
var message = [];
and push my chat object in message array;
var chat = new chat(data);
message.push(chat);
What is the best possible way to find the elements in message array by id. Or any thing else which make it easier also i need to short the array using date also.