From 4f75ecfa5f816dfe2ff50b6569b872cd88fba75b Mon Sep 17 00:00:00 2001 From: Kunal Sachdeva Date: Fri, 27 Oct 2017 13:32:26 +0530 Subject: [PATCH 1/3] Add JS question for map vs forEach functions to loop in array JSPerf gives a very good example code: https://jsperf.com/loop-vs-map-vs-foreach For detailed explanation: https://medium.com/@manojsinghnegi/array-methods-explained-filter-vs-map-vs-reduce-vs-foreach-ea3127c6d319 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 17ecdab..dec0e51 100755 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ This file contains a number of front-end interview questions that can be used wh * How would you go about checking for any of these states? * What is a closure, and how/why would you use one? * What's a typical use case for anonymous functions? +* Where would you use array.map() v/s forEach(array)? * How do you organize your code? (module pattern, classical inheritance?) * What's the difference between host objects and native objects? * Difference between: `function Person(){}`, `var person = Person()`, and `var person = new Person()`? From b6ae582d0eb6bfdec3590260319802f6bc0423c6 Mon Sep 17 00:00:00 2001 From: Kunal Sachdeva Date: Sat, 28 Oct 2017 01:03:03 +0530 Subject: [PATCH 2/3] Modify JS question for map vs forEach functions to loop in array --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dec0e51..661584c 100755 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ This file contains a number of front-end interview questions that can be used wh * What's the difference between a variable that is: `null`, `undefined` or undeclared? * How would you go about checking for any of these states? * What is a closure, and how/why would you use one? +* Can you describe the main difference between a `forEach` loop and a `.map()` loop and why you would pick one versus the other? * What's a typical use case for anonymous functions? * Where would you use array.map() v/s forEach(array)? * How do you organize your code? (module pattern, classical inheritance?) From f2899355ad936350177c9ba600fa6ebb3f3e6423 Mon Sep 17 00:00:00 2001 From: Kunal Sachdeva Date: Sat, 28 Oct 2017 01:04:44 +0530 Subject: [PATCH 3/3] Remove previously framed question --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 661584c..3638a28 100755 --- a/README.md +++ b/README.md @@ -112,7 +112,6 @@ This file contains a number of front-end interview questions that can be used wh * What is a closure, and how/why would you use one? * Can you describe the main difference between a `forEach` loop and a `.map()` loop and why you would pick one versus the other? * What's a typical use case for anonymous functions? -* Where would you use array.map() v/s forEach(array)? * How do you organize your code? (module pattern, classical inheritance?) * What's the difference between host objects and native objects? * Difference between: `function Person(){}`, `var person = Person()`, and `var person = new Person()`?