ES6+ const string = "false" const string2 = "true" const test = (val) => (val === "true" || val === "True") console.log(test(string)) console.log(test(string2))