0

function addTodo() {

const file = document.getElementById('imageInput').files[0];
const reader = new FileReader();
reader.readAsDataURL(file);

reader.onload = function(e) {
    const dataURL = reader.result;
   
    let imageRow = `
      <img src="${dataURL}" alt="img"/>
    `;
};

const id = '' + new Date().getTime()

}

How can i use imageRow after the reader.onload function ends? I want to use it after the random id is generated at the end. Can someone guide please

0 Answers0