是否有一个函数(或语言构造)我可以用来仅评估以下值true
(以及任何其他值false
)?
var trueValues = [
true, // boolean literal
"true", // string literal
"\t tRUe ", // case-insensitive string literal with leading/trailing whitespace
1, // number literal
1.00, // number literal
"1", // string literal of number literal
"1.0", // string literal of number literal
"1.00000000" // string literal of number literal
];