How can I convert a base64 string returned by reader.readDataAsUrl() to a string which looks exactely the same.
Javascript:
function getBase64(file) {
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function () {
        return reader.result;
    };
    reader.onerror = function (error) {
        console.log('Error: ', error);
        return false;
    };
} // works and returns a base64 version of the image
but when I do typeof(getBase64(...)) it says undefined. 
So how can I convert this base64 'string' to a real string
Background: I want to have a string and remove the "=" at the end as result
Edit/Solution:
I wasn't aware that reader.readAsDataURL is an asynchronous function and I had to wait for reader.onload().
 
    