更新时间:2021-06-30 23:21:14
var a = "website.html";
var name = a.split(".")[0];
如果文件名中带有点,您可以尝试...
If the file name has a dot in the name, you could try...
var a = "website.old.html";
var nameSplit = a.split(".");
nameSplit.pop();
var name = nameSplit.join(".");
但是,如果文件名类似于 my.old.file.tar.gz
,则它将认为 my.old.file.tar
是文件名
But if the file name is something like my.old.file.tar.gz
, then it will think my.old.file.tar
is the file name