📅  最后修改于: 2022-03-11 15:02:47.498000             🧑  作者: Mango
// using string methods only
filename.substring(0, filename.lastIndexOf('.')) || filename
// using both string & array methods
filename.split('.').slice(0, -1).join('.')