Heyy, how are you?!
Have you ever had to deal with some JavaScript functions just... they weren't exactly the way you expected? Maybe it looked li...
For further actions, you may consider blocking this person and/or reporting abuse
Did you know that the act of assigning an anonymous function to a variable makes that function no longer anonymous (in most cases)?
This code:
Is equivalent to this code:
BOTH functions actually have a name - so neither is anonymous. You can test this by checking
add.name
- which in both cases above will be'add'
.You can find more about anonymous functions in this post.
Yess, is not anonymous because it is assigned to a variable π ! Thanks for the tip and I'll definitely read it!!
Just because a function is assigned to a variable does not necessarily mean it is not anonymous. It is perfectly possible to assign an anonymous function to a variable without losing its anonymity:
The name of the variable and the name of the function are two different things:
Niiiicee π€©
I'd like to mention the IIFE (Immediately Invoked Function Expression) here. This is a JavaScript function that runs as soon as it is defined. See IIFE @ MDN .
Cool, I like the IIFE functions! We have Pure Functions too, for example! But in this article I just wanted to share some basic types! But thanks for the comment and the tip.
I think you could add potential use cases for them. Specifically maybe mention async await and which functions can/cannot use this. Additionally how some js methods mixed with arrow functions throw errors. Besides that, good stuff :)
Sure, I'm doing a new article talking about async/await, Promise and some other stuff! This article I just wanted to talk a little bit about some different types functions that we can use with JavaScript.
But thanks a lot for the tip π
can u revised my code ?
Hey, what code?! π€
express.js ? on my website: dimense.net code: github.com/reroote/core
Informative!
Thanks dude π₯³
I think it's worth mentioning too: high order functions are the basis of Decorators. For those not working with Angular or NestJS regularly, that syntax can be a little odd at first. But working with HOF will make the decorator syntax and use case very clear.
I think you should add generator functions
Π‘ongratulations π₯³! Your article hit the top posts for the week - dev.to/fruntend/top-10-posts-for-f...
Keep it up π