📅  最后修改于: 2022-03-11 15:03:59.983000             🧑  作者: Mango
function encodeToAmp(text) {
var el = document.createElement("div");
el.textContent = text;
el.innerText = text;
return el.innerHTML;
}
encodeToAmp('&;\'><"') // => &;'><"