瀏覽代碼

Merge pull request #10944 from jscheel/js/add-node-to-sort-custom-docs

Add note to Array#sort_custom about the dangers of using random values
Rémi Verschelde 8 年之前
父節點
當前提交
3873362b3d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      doc/base/classes.xml

+ 1 - 1
doc/base/classes.xml

@@ -5670,7 +5670,7 @@
 			<argument index="1" name="func" type="String">
 			</argument>
 			<description>
-				Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise.
+				Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
 			</description>
 		</method>
 	</methods>