ファイル選択フォームで選択されたファイルリストを取得する

<form name="form01" action="">
<input name="file" type="file" accept=".txt" />
<!-- accept属性でファイル形式を指定 -->
</form>const selectfile = document.forms.form01.file;
selectfile.addEventListener("change", () => {
console.log(selectfile.files);
console.log(selectfile.files[0].name);
});
取得する Filelist の内容
lastModified: 1544152237487
lastModifiedDate: Fri Dec 07 2018 12:10:37 GMT+0900 (日本標準時) {}
name: “memo.txt”
size: 496351
type: “image/jpeg” webkitRelativePath: “”