Uncaught TypeError: Cannot read property 'x' of undefined common.js
<p>I am using google map api v3 and got this error while using the</p>

<p><strong>map.fitBounds(bounds);</strong> function</p>

<p>Here is the error snapshot on console
<a href="https://i.stack.imgur.com/ISfDI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ISfDI.jpg" alt="enter image description here"></a></p>

<p>And Here is the Code:</p>

<pre><code>var arr = [{lat: -25.363, lng: 131.044}, {lat: 12.97, lng: 77.59}];
for (i = 0; i &lt; arr.length; i++) {
    bounds.extend(new google.maps.LatLng(arr[i]));
}
map.fitBounds(bounds); //If I comment this line in m code, the error is gone but map does not load.
</code></pre>

<p>what is the problem? Also how can I solve it?</p>