// get the file in Base64
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
var storeInTheGlobalVariable = '';
var ImageBase64 = getBase64(bottomBannerImage).then(function(data){
storeInTheGlobalVariable = data; // not woking -> undefine
console.log(data) // working fine
});
I don't want to console log. I want the promise resolve data. How I will get It outside of this then() method