📅  最后修改于: 2022-03-11 15:02:35.554000             🧑  作者: Mango
let str = " ";
if (!str.replace(/\s/g, "").length) {
console.log("string only contains whitespace (ie. spaces, tabs or line breaks)");
}