From cc03ce3d7332457067e320d182307a3fc7285a4e Mon Sep 17 00:00:00 2001 From: wildskyf Date: Wed, 14 Apr 2021 17:40:06 +0800 Subject: remove useless dir="rtl" for zh-TW --- .../zh-tw/web/javascript/reference/global_objects/array/sort/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-tw/web/javascript/reference/global_objects/array') diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html index 7240184a75..bfb0eb739f 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html @@ -175,7 +175,7 @@ items.sort(function (a, b) {

compareFunction 可以被陣列中的各個元素多次呼叫。依據 compareFunction 的特性,這將會產生大量運算。越多元素要排序 compareFunction 就越多工作要做,因此選擇使用 map 來排列也就是一個更明智的選擇。作法為先迭代陣列一次來取得排序時所需的值至暫時的陣列,並對此臨時陣列進行排序。然後再迭代臨時陣列來將正確順序之值放入原始陣列中。

-
// the array to be sorted
+
// the array to be sorted
 var list = ['Delta', 'alpha', 'CHARLIE', 'bravo'];
 
 // temporary array holds objects with position and sort-value
-- 
cgit v1.2.3-54-g00ecf