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