doc: port old Array#compact docs and clarify

This commit is contained in:
tjcrowder 2009-09-07 12:18:22 +01:00 committed by Tobie Langel
parent 7fcd513364
commit a6dac432ac

View File

@ -167,7 +167,15 @@ Array.from = $A;
/**
* Array#compact() -> Array
* Returns a copy of the array without any `null` or `undefined` values.
*
* Returns a **copy** of the array without any `null` or `undefined` values.
*
* ### Example
*
* var orig = [undefined, 'A', undefined, 'B', null, 'C'];
* var copy = orig.compact();
* // orig -> [undefined, 'A', undefined, 'B', null, 'C'];
* // copy -> ['A', 'B', 'C'];
**/
function compact() {
return this.select(function(value) {