Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <canvas id="canvas1" width="30" height="30" style="border:solid 1px black;"></canvas>
  <canvas id="canvas2" width="30" height="30" style="border:solid 1px black;"></canvas>
  
  <script>
    let ctx1 = canvas1.getContext("2d");
    ctx1.textBaseline = "top";
    canvas1.width = 31;
    canvas1.height = 31;
    ctx1.fillText("hi", 10, 10);
    // fixed:
    let ctx2 = canvas2.getContext("2d");
    ctx2.textBaseline = "top";
    canvas2.width = 31;
    canvas2.height = 31;
    ctx2.textBaseline = "top"; // <-- need to add this to get it to work
    ctx2.fillText("hi", 10, 10);
    
  </script>
  
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers