Not sure of the rationale; however, it looks like Chrome now supports something 
similar natively:

 

 
<https://twitter.com/malyw/status/704972953029623808?utm_source=javascriptweekly&utm_medium=email>
 
https://twitter.com/malyw/status/704972953029623808?utm_source=javascriptweekly&utm_medium=email

 

From: es-discuss [mailto:[email protected]] On Behalf Of Langdon
Sent: Friday, March 4, 2016 11:22 AM
To: [email protected]
Subject: Object.prototype.forIn

 

My apologies if this has been discussed before (I have to imagine it has, but 
couldn't find anything).

 

Why isn't there a `forIn` method on Object natively?

 

Something that simply wraps this all-to-common code:

 

var key;

 

for (key in obj) {

  if (obj.hasOwnProperty(key) === true) {

    ...

  }

}

 

Example: https://jsfiddle.net/langdonx/d4Lph13u/

 

TIA,

Langdon

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to