JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="canvas" width="300" height="300"></canvas>

CSS

#canvas {
background: yellow;   
}

JavaScript

var canvas = document.getElementById('canvas');  

if (canvas.getContext){  
    var ctx = canvas.getContext('2d');  
    ctx.fillStyle = "#F0F";
    
    var args = [
      10, 10, 180, 180  
    ];
    var op = "fillRect";
    
    (ctx[op]).apply(ctx, args);
}