Sprint-Challenge--JavaScript --- Venky Yagatilee - #548
Conversation
Comprehension Questions
Objects and Arrays
Functions
Prototypes
Classes
|
mykeal-kenny
left a comment
There was a problem hiding this comment.
Great Job Venky! I know this was a hard week for everyone, but you really came through!
| @@ -1 +1,33 @@ | |||
| 1. Describe the biggest difference between `.forEach` & `.map`. | |||
| map return new array of the same length and allocates new memory for the array where as forEach does not return new array. Withe respect to speed, map method is effective and most economic. | |||
There was a problem hiding this comment.
Yes! This is the first perfect answer venky! Great Job!
| 1. Describe the biggest difference between `.forEach` & `.map`. | ||
| map return new array of the same length and allocates new memory for the array where as forEach does not return new array. Withe respect to speed, map method is effective and most economic. | ||
| 2. What is the difference between a function and a method? | ||
| A method is a function associated with objects where as functions are not associated with objects. |
| A method is a function associated with objects where as functions are not associated with objects. | ||
| 3. What is closure? | ||
| It is the ability of a function to remember and continue to access the variables surrounded in that lexical scopes..even if you take that function send elsewhere OR pass it else where and it executes in entirely different scope. | ||
|
|
There was a problem hiding this comment.
On a roll with the good answers Venky!
| } | ||
| const me = new Person("venky", 33); | ||
| 4) Explicit binding:- Whenever we use javascript methods such as call(), apply(), and bind() the key word 'this' is explicit. | ||
|
|
There was a problem hiding this comment.
Perfect! Keep these in mind as everything else will build on these concepts. THIS, while being ridiculous in it's own way, will definitely make things easier to understand later on.
Exactly what I was looking for. When you're asked to write examples, try to imagine you're explaining it to a 10 year old. If you can explain it to a 10 year old, you can understand the work. Great Job!
| console.log(consume(2,2,add)); // 4 | ||
| console.log(consume(10,16,multiply)); // 160 | ||
| console.log(consume("Mary","Poppins", greeting)); // Hello Mary Poppins, nice to meet you! | ||
|
|
There was a problem hiding this comment.
You follow the When in doubt when making your own code, console.log every time. rule very well!
| */ No newline at end of file | ||
| */ | ||
|
|
||
| class CubeMaker extends CuboidMaker { |
There was a problem hiding this comment.
I appreciate the stretch goals! These always help you grow as a programmer.
| } | ||
| } | ||
| } | ||
| return arr; |
There was a problem hiding this comment.
Nice For loop! They're faster and help you get a better understanding of whats going on underneath it all.
Hi,
@fireInjun