From af4edc3b762a21ac2660b1cf2c0f9e9193a39ca9 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Wed, 25 Jun 2014 14:39:12 -0700 Subject: [PATCH] Updated forEach object example to include the keys. [ci skip] [closes #596] The forEach object example is a little ambiguous where it says "logs each number", since both the key and value of the object are technically numbers. I've read it a few times now (skipping over the function description of course) and wanted it to be a little more obvious. --- lodash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 6330524ec..6168891bf 100644 --- a/lodash.js +++ b/lodash.js @@ -4370,8 +4370,8 @@ * _([1, 2, 3]).forEach(function(n) { console.log(n); }).join(','); * // => logs each number and returns '1,2,3' * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n) { console.log(n); }); - * // => logs each number and returns the object (property order is not guaranteed across environments) + * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num, key) { console.log(num, key); }); + * // => logs each number-key pair ('1 one') and returns the object (property order is not guaranteed across environments) */ function forEach(collection, iterator, thisArg) { return (typeof iterator == 'function' && typeof thisArg == 'undefined' && isArray(collection))