Little life saver: parsing HTML entities

Recently I had the pleasure of building a calculator example exercise. Begin a good programmer I used the some HTML entities as values on the buttons: ×, ÷ and ± as values. It turned out to be quite difficult to parse them with native JavaScript. It is not so hard with LoDash or jQuery, but I wanted to do it native.

I ended up using the following script I got from a StackOverflow answer:

var PLUSMINUS = getHtmlEntityString('±');
var DIVIDE = getHtmlEntityString('÷');
var TIMES = getHtmlEntityString('×');

function getHtmlEntityString(str) {
    var d = document.createElement("div");
    d.innerHTML = str;
    return typeof d.innerText !== 'undefined' ? d.innerText : d.textContent;