JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="myCanvas" width="200" height="100"></canvas>
JavaScript
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75);
var url = c.toDataURL('image/jpeg');
var v = 0
for(var i = 0; i < 100; i++ ){
v += 0.01;
x = parseFloat((v).toFixed(2))
var test = c.toDataURL('image/jpeg', x);
if(test == url){
console.log('The default value is: ' + x);
alert('The default value is: ' + x)
}
}