I have a little problem.
I have situations where my ajax calss returns a string.
sometimes that string is “false”
i want to always convert that string value into a boolean
i tried : new Boolean(thatValue)
but it returns true even for “false” as a paremter
is there anyway to solve this? except me writing my own custom function that will return false if “flase” ?..
thank you
The best way to do this you’ve already described:
Or:
You’re limited by JavaScript’s weak typing here, actually working to your disadvantage, where any non-empty string will convert to a
trueboolean, even if that string is"false".To get it and store it for use elsewhere, something like this works: