diff --git a/README.md b/README.md
index a1f3de8a..b15f9f39 100644
--- a/README.md
+++ b/README.md
@@ -13,23 +13,23 @@ Please read [how to contribute](./src/content/how-to-contribute.md) if you want
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
[//]: contributor-faces
diff --git a/src/content/lodash/collection/forEach/lodash.js b/src/content/lodash/collection/forEach/lodash.js
index 0e8ff7ec..1b792a76 100644
--- a/src/content/lodash/collection/forEach/lodash.js
+++ b/src/content/lodash/collection/forEach/lodash.js
@@ -9,3 +9,10 @@ forEach(array, (item, index) => {
// => a 0
// => b 1
// => c 2
+
+const obj = { a: 'red', b: 'green' }
+forEach(obj, (item, key) => {
+ console.log(item, key)
+})
+// => red a
+// => green b
\ No newline at end of file
diff --git a/src/content/lodash/collection/forEach/notes.md b/src/content/lodash/collection/forEach/notes.md
index fdbe258d..5cc14d9c 100644
--- a/src/content/lodash/collection/forEach/notes.md
+++ b/src/content/lodash/collection/forEach/notes.md
@@ -1,3 +1,3 @@
Iterates over elements of collection
and invokes iteratee
for each element. The iteratee is invoked with three arguments: (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false
.
-Resources: [Array#forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) [Source](https://www.reindex.io/blog/you-might-not-need-underscore/#iterate)
+Resources: [Array#forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) [Object#entries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) [Source](https://www.reindex.io/blog/you-might-not-need-underscore/#iterate)
diff --git a/src/content/lodash/collection/forEach/spec.js b/src/content/lodash/collection/forEach/spec.js
index 99a5feab..df3e701c 100644
--- a/src/content/lodash/collection/forEach/spec.js
+++ b/src/content/lodash/collection/forEach/spec.js
@@ -14,6 +14,8 @@ describe('forEach', () => {
expect(console.log).toHaveBeenNthCalledWith(1, 'a', 0)
expect(console.log).toHaveBeenNthCalledWith(2, 'b', 1)
expect(console.log).toHaveBeenNthCalledWith(3, 'c', 2)
+ expect(console.log).toHaveBeenNthCalledWith(4, 'red', 'a')
+ expect(console.log).toHaveBeenNthCalledWith(5, 'green', 'b')
})
})
@@ -32,6 +34,8 @@ describe('forEach', () => {
expect(console.log).toHaveBeenNthCalledWith(1, 'a', 0)
expect(console.log).toHaveBeenNthCalledWith(2, 'b', 1)
expect(console.log).toHaveBeenNthCalledWith(3, 'c', 2)
+ expect(console.log).toHaveBeenNthCalledWith(4, 'red', 'a')
+ expect(console.log).toHaveBeenNthCalledWith(5, 'green', 'b')
})
})
})
diff --git a/src/content/lodash/collection/forEach/vanilla.js b/src/content/lodash/collection/forEach/vanilla.js
index 7a83e2f3..01c0fb80 100644
--- a/src/content/lodash/collection/forEach/vanilla.js
+++ b/src/content/lodash/collection/forEach/vanilla.js
@@ -1,6 +1,12 @@
-;['a', 'b', 'c'].forEach((item, index) => {
+['a', 'b', 'c'].forEach((item, index) => {
console.log(item, index)
})
// => a 0
// => b 1
// => c 2
+
+Object.entries({ a: 'red', b: 'green' }).forEach(([key, item]) => {
+ console.log(item, key)
+})
+// => red a
+// => green b
\ No newline at end of file