I have a JavaScript string containing "true" or "false".
"true"
"false"
How may I convert it to boolean without using the eval function?
eval
var val = (string === "true");
Case insensitive:
const val = (string.toLowerCase() === "true");