Make a Pac-Man in JavaScript

// Create a canvas

let canvas = document.createElement('canvas');

// Set the width and height of the canvas
canvas.width = 500;
canvas.height = 500;

// Get the canvas context
let ctx = canvas.getContext('2d');

// Create the Pac-Man
ctx.beginPath();
ctx.arc(250, 250, 50, 0.25 * Math.PI, 1.75 * Math.PI);
ctx.lineTo(250, 250);
ctx.fillStyle = 'yellow';
ctx.fill();

// Create the eyes
ctx.beginPath();
ctx.arc(240, 245, 5, 0, 2 * Math.PI);
ctx.fillStyle = 'black';
ctx.fill();

ctx.beginPath();
ctx.arc(260, 245, 5, 0, 2 * Math.PI);
ctx.fillStyle = 'black';
ctx.fill();

// Add the canvas to the DOM
document.body.appendChild(canvas);