var obj = {
'foo': 1,
'bar': 2
};
for (var key in obj) {
console.log(obj[key]);
}
Or with jQuery:
$.each(obj, function(key, value) {
console.log(this, value, obj[key]);
});
More Related Contents:
- How To Display Images Preview and Title When I Paste in Another Site Like Facebook, Whatsapp, etc
- Prototypical inheritance – writing up [duplicate]
- How to get all properties values of a JavaScript Object (without knowing the keys)?
- jQuery .live() vs .on() method for adding a click event after loading dynamic html
- Crockford’s Prototypal inheritance – Issues with nested objects
- Post data to JsonP
- Javascript: Setting location.href versus location
- How to check whether a Storage item is set?
- JSON.stringify doesn’t work with normal Javascript array
- Regex created via new RegExp(myString) not working (backslashes)
- How to deeply merge two object values by keys
- How does the “this” keyword work, and when should it be used?
- Difference between the javascript String Type and String Object?
- Specify scope for eval() in JavaScript?
- Dynamically load a stylesheet with React
- How to wait for a WebSocket’s readyState to change
- how to disable DIV element and everything inside [duplicate]
- How can I access a variable outside a promise `.then` method?
- Random number generator without dupes in Javascript?
- Human readable javascripts in chrome developer tools
- JavaScript: difference between a statement and an expression?
- Determine if user navigated from mobile Safari
- The Safari Back Button Problem
- Are there differences between .then(functionReference) and .then(function(value){return functionReference(value)})?
- Websocket API to replace REST API? [closed]
- In what JS engines, specifically, are toLowerCase & toUpperCase locale-sensitive?
- Force iOS numeric keyboard with custom / currency pattern
- Center an Image vertically and horizontally using CSS
- Differentiating Between an AJAX Call / Browser Request
- JavaScript – Reference Browser Window by name? [duplicate]