From a6dac432acaaf7b7620c4120cd87e58bbd10f940 Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Mon, 7 Sep 2009 12:18:22 +0100 Subject: [PATCH] doc: port old Array#compact docs and clarify --- src/lang/array.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lang/array.js b/src/lang/array.js index 7e9edd5..ae463bf 100644 --- a/src/lang/array.js +++ b/src/lang/array.js @@ -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) {