JSFiddle - React, Tailwind, and code Playground
JavaScript
/**
As of 06/18/2016, this syntax is not available in most browsers. For example in Chrome you even need
to enable this flag before it will work: chrome://flags/#enable-javascript-harmony (type this in your URL bar).
*/
var p = {a:1, b:"two", c:[1,2,3], d: {r:3, s:"four"}};
for (let [key, value] of Object.entries(p)) {
console.log(key); // This is the key;
console.log(value); // This is the value;
}
console.log('----------')
p = {
"p1": "value1",
"p2": "value2",
"p3": "value3"
};
for (let [key, value] of Object.entries(p)) {
console.log(key); // This is the key;
console.log(value); // This is the value;
}