If you are interested, I have created a functional live codepen demonstration that can be accessed here. By clicking on the grid within the demo, a red square will appear. Is there any guidance available on transitioning this red square into a red triangle? I attempted to make alterations to the code provided below but encountered some challenges. Thank you for taking the time to review this and I hope you have a wonderful day.
newDot.className = 'red-dot';
// Set coordinates:
newDot.style.top = y + 'px';
newDot.style.left = x + 'px';