There’s no need for Prototype here: JavaScript has for..in
loops. If you’re not sure that no one messed with Object.prototype
, check hasOwnProperty()
as well, ie
for(var prop in obj) {
if(obj.hasOwnProperty(prop))
doSomethingWith(obj[prop]);
}
More Related Contents:
- Creating a new DOM element from an HTML string using built-in DOM methods or Prototype
- How to autosize a textarea using Prototype?
- JSON.stringify() array bizarreness with Prototype.js
- Trigger an event with Prototype
- How to pass Ruby variables to a JavaScript function in a Rails view?
- Ways to add javascript files dynamically in a page
- Select div using wildcard ID
- Restoring console.log()
- Using JQuery and Prototype in the same page
- Ajax Binary Response
- Prototype AJAX request being sent as OPTIONS rather than GET; results in 501 error
- document.createElement(‘script’)… adding two scripts with one callback
- Prototype equivalent for jQuery live function
- How to have a mouseover event fire only if the mouse is hovered over an element for at least 1 second?
- Img src path with header params to pass
- Load javascript async, then check DOM loaded before executing callback
- prototypal inheritance concept in javascript as a prototype based language
- How to avoid conflict between JQuery and Prototype
- styled components final styles are injected directly in DOM with tag, with style tag injection does performance gets affected?
- HTTP headers in Websockets client API
- Set Value of Input Using Javascript Function
- this operator in javascript
- How to clear cache of service worker?
- Modify object property in an array of objects
- (Embed and) Refer to an external SVG via D3 and/or javascript
- Real world examples of Ecmascript functions returning a Reference?
- JQuery Ajax Post results in 500 Internal Server Error
- Jquery: mousedown effect (while left click is held down)
- how express forming the img URL
- How to put “” in a javascript string?