Comparing strings

We were using a simple logic comparator to determine which of two strings is alphabetically “greater than” (“a” > “b” in the alphabet):

This works most of the time, but sometimes it doesn’t… so we had to create logic that sorts a list of two items alphabetically (which works 100%).

So I’m just curious — how does the “simple compare logic” block work when comparing two strings? What’s the underlying algorithm?

When in doubt, see the generated code:

UI Builder - DatabaseCourse - Backendless 2023-04-01 15-52-48

Here’s an article on string comparison in JS:

Hope this helps.

Regards,
Mark

Awesome answer, showing us the general way one can inspect what is happening “under the hood” in JS :heart: