1

For some reason I am getting an error with my FileReader unload function. The error is Parsing error: Invalid left-hand side in assignment expression I looked in to what that means to according to MDN web docs: "invalid assignment left-hand side" occurs when there was an unexpected assignment somewhere. For example, a single "=" sign was used instead of "==" or "===". I don't see how this would be a error.

 var fileInput = files[0];
 var audioCtx = new AudioContext(files[0]);
 var reader1 = new FileReader();
 reader1.onload() = function (ev) { //error here
     //decode audio
          audioCtx.decodeAudioData(ev.target.result).then(function(buffer) {
                reader1.readAsArrayBuffer(fileInput.files[0]);
            })
        }

1 Answer 1

1

onload is a property, not a method.

reader1.onload = function (ev) { 
   ...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.