1
我正在尝试编写一个函数,该函数使用一个字符串数组和一个返回数组中的字符串的数字,该数组的长度比定义的数字更长。用于返回数组中长度超过定义数的字符串的Javascript函数
下面是我已经开始与代码:
var words = ["Harold", "hen", "asdasda"];
var i = 5
words.sort(function filterLongWords(x , i){
if (words[x].length > i){
return words[x];
}
else {
console.log("You have no words longer than the number " + i + ".");
}
});
谢谢!
适合你...有什么问题呢? – pna 2015-01-15 16:38:05