Conversion of base64 to image results in a "Failed to load resource: net::ERR_INVALID_URL" error when array is used.
<p>Basically when I use:</p>

<pre><code>imageObj.src = "data:image/webp;base64,data[2]";
</code></pre>

<p>It will give me an error.</p>

<p>However, when I console.log(data[2]) and then copy and paste whatever data[2] is into the code like this: </p>

<pre><code>imageObj.src = "data:image/webp;base64,sampleexampleasfnakdjfbaksjbrwkaerhdhcoaunsf";
</code></pre>

<p>Everything works out. Please help me understand?</p>