Testing Object.prototype.hasOwnProperty

The hasOwnProperty method of the Object class is documented in ECMAScript section 15.2.4.5. Does your browser support it? Let's find out:

Object.prototype.toSourceCode = function(){ /*stuff*/ }

var animalSounds = { cat:'meow', dog:'woof' };
var output = '';

for (var animal in animalSounds){
  if ( !animalSounds.hasOwnProperty || animalSounds.hasOwnProperty(animal) ){
	output += 'The '+animal+' says "'+animalSounds[animal]+'"\n';
  }
}

Expected output:

The cat says "meow"
The dog says "woof"

Actual output from your browser: