Tuesday 11 December 2018

React Native/Javascript - How to know that object does not have the property?

Let say :



myVariable.color;
myVariable.height;
myVariable.width;


But sometimes, myVariable only have "color" and "height" property.



I have try this, but no luck :




if(myVariable.width == undefined) {
//but not filtered here
}


How to know if myVariable doesn't contain "width" property by code, is it possible ?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...