To add an image in JavaScript, add an
img
element to body
.Here's how you do it:
const img = document.createElement('img');
img.src = 'https://whaa.dev/favicon.png'; // put your URL here
img.width = 400; // change width if needed
img.height = 400; // change height if needed
document.body.appendChild(img);