Why this simple code keeps showing fail to load [duplicate]

I have this simple code which trying to make and download a pdf file by using JS blob.

let text = 'download'
function make(){
    const data = new Blob([text],{ type: 'application/pdf' })
    document.querySelector('a').href = window.URL.createObjectURL(data);
}
make()
<a download>Download</a>

It does work, but problem is when I open the downloaded file, it shows fail to load pdf file.enter image description here

There are several questions and similar ways to download pdf file use blob, but I can’t figure out what I did wrong and how to fix it.

What I am missing?

Any suggestions and answer will be appreicated.