snippet

Comparing strings on Javascript

It is possible to compare two strings of characters, in the same way as comparing two numbers. To do this you need to use one of the following operators to get a meaningful result via the alphabetical order.

'e' < 'f' // return true
'e' > 'f' // return false

'ab' > 'cd' // return false
'ab' < 'cd' // return true
Related snippets