Let's say I have three strings:
var s1 = 'Tokyo';
var s2 = 'Tokyo is pretty neat';
var s3 = 'Tokyo is pretty neat at summer';
And I wanna compare s3
to s2
and s1
and find the 'best' match for s3
among s1
and s2
. I mean, the matching algorithm should return s2
in this case, as it has more in common with s3
. How can I do that? As a rule, simple check using indexOf() was enough for me, but now I need to find the 'best' match.