📅  最后修改于: 2022-03-11 15:01:16.129000             🧑  作者: Mango
const htmlEntities = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
return str.replace(/([&<>\"'])/g, match => htmlEntities[match]);
}