📌  相关文章
📜  Javascript 将 html 实体转换为字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:16.129000             🧑  作者: Mango

代码示例1
const htmlEntities = {
    "&": "&",
    "<": "<",
    ">": ">",
    '"': """,
    "'": "'"
  };
return str.replace(/([&<>\"'])/g, match => htmlEntities[match]);
}