❇ Crisp n Clear👌 🏆O(N)❤️ Javascript❤️ Memory👀48.15%🕕 Meaningful Vars✍️ 🔴❇ ✅ 👉 💪🙏
Runtime: 233 ms, faster than 33.33% of JavaScript online submissions for HTML Entity Parser.\nMemory Usage: 50.9 MB, less than 48.15% of JavaScript online submi
Runtime: 233 ms, faster than 33.33% of JavaScript online submissions for HTML Entity Parser.\nMemory Usage: 50.9 MB, less than 48.15% of JavaScript online submissions for HTML Entity Parser.\n```\nconst config = {\n  \'&\': {\n    \'&a\': {\n      \'&ap\': { \'&apo\': { \'&apos\': { \'&apos;\': "\'" } } },\n      \'&am\': { \'&amp\': { \'&amp;\': \'&\' } }\n    },\n    \'&q\': { \'&qu\': { \'&quo\': { \'&quot\': { \'&quot;\': \'"\' } } } },\n    \'&f\': { \'&fr\': { \'&fra\': { \'&fras\': { \'&frasl\': { \'&frasl;\': \'/\' } } } } },\n    \'&g\': { \'&gt\': { \'&gt;\': \'>\' } },\n    \'&l\': { \'&lt\': { \'&lt;\': \'<\' } }\n  }\n};\nfunction resolveSpecialSymbols(text, fromIndex) {\n  let tempString = ``;\n  let otherOutput = ``;\n  let index = fromIndex;\n  let currentConfig = config;\n  for (; index < text.length; index++) {\n    tempString = `${otherOutput}${text[index]}`;\n    if (currentConfig[tempString]) {\n      currentConfig = currentConfig[tempString];\n      otherOutput += text[index];\n    } else {\n      break;\n    }\n  }\n  return {\n    output: typeof currentConfig === \'string\' ? currentConfig : otherOutput,\n    toIndex: index\n  };\n}\n\nvar entityParser = function (text) {\n  let str = \'\';\n  for (let index = 0; index < text.length; ) {\n    if (config[text[index]]) {\n      const getResolveSpecialSymbols = resolveSpecialSymbols(text, index);\n      const { output, toIndex } = getResolveSpecialSymbols;\n      str += output;\n      index = toIndex;\n    } else {\n      str += text[index];\n      index++;\n    }\n  }\n  return str;\n};\n```
['JavaScript']