SOURCE

console 命令行工具 X clear

                    
>
console
window.onload = function() {
  const text = `hello world/nzhangli`
  const blob = new Blob([text], {type: 'text/html,charset=UTF-8'})
  document.querySelector("#getData").href = URL.createObjectURL(blob)
}
<a download="data.txt" id="getData">下载</a>