7 different ways to write JavaScript functions (explained for beginners)

7 different ways to write JavaScript functions (explained for beginners)

Code With Bubb

9 месяцев назад

1,640 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@Shehjeishiwwhbememd
@Shehjeishiwwhbememd - 07.11.2023 16:21

❤thanks

Ответить
@djlee0721
@djlee0721 - 07.11.2023 16:36

Another great video 🙌🏻

Ответить
@harpo187bling
@harpo187bling - 07.11.2023 18:24

Nice t-shirt.

Ответить
@user-bh1pn1cr8p
@user-bh1pn1cr8p - 07.11.2023 19:52

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.

Ответить
@inteltone
@inteltone - 07.11.2023 21:51

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.

Ответить
@oukiebotha2227
@oukiebotha2227 - 07.11.2023 22:04

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😂😂,😊😊👍👍

Ответить
@BloodyClash
@BloodyClash - 08.11.2023 10:20

😁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

Ответить
@amiranGo
@amiranGo - 09.11.2023 13:17

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)

Ответить
@fritiofrusck
@fritiofrusck - 09.11.2023 22:03

eval(" function foo() { return \"bar\"; } ")

Ответить
@benb3928
@benb3928 - 10.11.2023 08:25

aw to no closures, _prototype_ or .apply for types 8.9, and 10

Ответить
@CheefCoach
@CheefCoach - 21.11.2023 18:03

The first way is the best way to write functions. Unless you are inside of class, object or callback.

Ответить
@codewithbubb
@codewithbubb - 07.11.2023 16:22

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!

Ответить