js排序尾部带数字的字符串数组:["a1","a2","a3""a10","a11"]

            var keys = ["a1","a2","a3","a10","a11"];

            var keys = keys.sort(function(a,b){

                return parseInt(a.replace(/a/g,"")) - parseInt(b.replace(/a/g,""));

            });

            console.log("排序:",keys);

你可能感兴趣的:(js排序尾部带数字的字符串数组:["a1","a2","a3""a10","a11"])