I'm new to JavaScript and I'm not sure how to convert these two arrow functions into regular functions. If someone could convert them and give me an explanation that would be great!
function getBase64(file) {
try {
return new Promise(resolve => {
//var file = new File([filename], filepath);
var reader = new FileReader();
// Read file content on file loaded event
reader.onload = function(event) {
$window.setTimeout(()=>{
resolve(reader.result.replace(/^data:.+;base64,/, ''));
},250);
};
reader.readAsDataURL(file);
});
}
catch (e)
{
console.log ("error "+ e);
}
}