Iterate over an object in es6
<p>This works fine for me:</p>

<pre><code>const iterable = [1, 2, 3];

for (const value of iterable) {
    console.log(value);
}
</code></pre>

<p>However this does not work:</p>

<pre><code>const iterable = {1:10, 2:20, 3:30};

for (const value of iterable) {
    console.log(value);
    console.log(iterable[value]);
}
</code></pre>

<p>Instead giving me the error: </p>

<pre><code>Uncaught TypeError: iterable[Symbol.iterator] is not a function(…)
</code></pre>

<p>How should I be doing this?</p>

<p>This is what I do now:</p>

<pre><code>for(const value in iterable){
    if (iterable.hasOwnProperty(value)) {
        console.log(value);
        console.log(iterable[value]);
    }
}
</code></pre>