Комментарии:
❤thanks
ОтветитьAnother great video 🙌🏻
ОтветитьNice t-shirt.
Ответитьhello Brother,
Brother, I am stuck in javascript functions for so long I mean for four days and this issue is not getting clear.
Brother I recorded the video of my problem because it would then get hard for me to type my problem in detail here.
just give me some source so I could share a video with you.
Here's the code. (This is the solved version. but I am not still cleared).
```
function add(number){
const sum = number + number;
return sum;
}
const result = add(5);
console.log(result);
```
and except all this.
You are legend.
Lot's of love.
Very useful information, but its presentation makes it very difficult to understand. The material is told and shown too quickly. For a beginner to understand it, you need to watch the video 2-3 times or even more.
ОтветитьHi James. Agree, great video, thanks, 🙏🙏. I thought a function declaration is the way to go. Still struggling to understand and practice arrow functions. You are an excellent teacher with a great t shirt😂😂,😊😊👍👍
Ответить😁usually i quit when people call javascript a programming language. but this time...was interesting to see how much javascript already has gotten from its big brother
ОтветитьProtip: Almost never use `this` unless you're actually in a Class. Even with the example of the factorial you provided, you're better off with just referring to the object itself:
const myMath = {
factorial(n) {
if (n === 0) return 1;
return n * myMath.factorial(n - 1);
}
}
This way, you can also destruct the function out of the object and it will still work:
const { factorial } = myMath;
factorial(5)
eval(" function foo() { return \"bar\"; } ")
Ответитьaw to no closures, _prototype_ or .apply for types 8.9, and 10
ОтветитьThe first way is the best way to write functions. Unless you are inside of class, object or callback.
ОтветитьI have this written up as a blog article but I can't build my site at the moment! I'll add a link to it once I can publish the article!
Ответить