Category: Question and Answers
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Non-empty-string doesn’t evaluate to true when using on button.Disabled

Issue

I am trying to check if a string evaluates to true but it is not working. I expected it to be true but it is not. Should I create a function or is there an easy fix?

Resolution

The user was trying to evaluate a string in a logical expression to check if it was true. However, the expected result was not being returned. The suggested solution was to use the double exclamation mark (!!u.book().future_revision_id) to check if there was any value which would return true if there was a value and false if the value was undefined or null. The user can use this expression in their code to check if the string returns a true or false value. There is no need to create a separate function for this.