I resized canvas to keep a 16:9 aspect ratio but I'm not sure how to unstretch it

Question: I resized canvas to keep a 16:9 aspect ratio but I’m not sure how to unstretch it. My idea is that a little of the canvas will be offscreen to keep a flush, unstretched look with users with any screen size.

Repl link: https://replit.com/@ColoredHue/BulletPartyio

Edit: This is what I am doing to change the aspect ratio:

canvas.width = document.documentElement.clientWidth;
canvas.height = 9 * canvas.width / 16;
var playersize = canvas.width / 50
var playerspeed = canvas.width / 250