Sort JavaScript String Array containing numbers
问题 I have an array in JavaScript that contains the following: ["Value 1", "Value 5". "Value 10", "Value 11"]; How would I go about sorting this array so that it does not appear as follows: ["Value 1", "Value 10". "Value 11", "Value 5"]; But as: ["Value 1", "Value 5". "Value 10", "Value 11"]; Any help would be great. 回答1: If you are enthusiastic about writing it yourself, you can just parse the items with an regular expression and compare the second part. Those will match something like "Value\s