Compare string to number according to javascript semantics