August 17, 2013 One of the best way to check property of an Object in JavaScript I always wonder which is the best way to check property of any Object in Javascript. Here is the example Example 1 JavaScript if ("geolocation" in window.navigator) { window.navigator.geolocation.getCurrentPosition(function (position) { //TODO }, function () { //TODO: Still, Countn't find it }); } else { } 12345678910 if ("geolocation" in window.navigator) { window.navigator.geolocation.getCurrentPosition(function (position) { //TODO }, function () { //TODO: Still, Countn't find it });}else { } Example 2 JavaScript if ("FB" in window) { FB.Canvas.scrollTo(0, 0); } else { //TODO: Facebook SDK is not initiated } 123456 if ("FB" in window) { FB.Canvas.scrollTo(0, 0);}else { //TODO: Facebook SDK is not initiated}