How do I check if a key doesn't exist in javascript?
I have the below and I want to check if docs[3].created
exists and has a value and if it does then add it to the thevalue
variable.
With this, since docs[3].created
doesn´t exits I get "Cannot read property 'created' of undefined" error.
var docs=[{ created: 2016-01-10, name: "Claes"},{ created: 2016-01-11, name: "Lisa"}];
var thevalue = docs[3].created;
I really need some help with this, thanks a lot!