Question

Doesn't JS allow comparison of 2 string literals? e.g:

"Some String" == "Some String"

If not, was it different in some previous versions?

Background of the question: I use ECMA-Script in Qt 4. My DSL-Engine transforms parts of DSL-Scripts to JS and evaluates it. Since I moved from Qt4.7.4 (LGPL) to Qt4.8.4 (Commercial) the evaluation of the code above fails. In Qt4.7.4 I used to get true/false. Now the QScriptEngine::evaluate says the syntax was not correct.

Thank you for any advice!

Was it helpful?

Solution

Yes, js allows comparisons of 2 string literals.

"Some String" == "Some String" should always return true. Some examples of the surrounding code might help give some more insight.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top