安装 npm install itheima-tools-lh 导入 const itheima = require("iteheima-tools-lh"); 格式化时间 const dtStr = itheima.dateFormat(new Date()); 转义 HTML 中的特殊字符 const htmlStr = '<h1 title="abc">这是 h1 标签 <span>123 </span></h1>'; const str = itheima.htmlEscape(htmlStr); console.log(str); 开源协议 ISC