function htmlEncode(html){
return document.createElement("a").appendChild(document.createTextNode(html));
}
console.log(htmlEncode(""))
output result "
"
function htmlEncode(html){
return document.createElement("a").appendChild(document.createTextNode(html).parentNode.innerHTML);
}
console.log(htmlEncode(""))
Why the result of the output becomes
its innerHTML is obviously
?