taniarascia / taniarascia.com

💾 ‎ Personal website running on Gatsby, React, and Node.js.
https://www.taniarascia.com
MIT License
2.01k stars 540 forks source link

issue in article you wrote #165

Closed slk333 closed 2 years ago

slk333 commented 2 years ago

Hi I create an issue here since I could not find any other way to contact you:

https://www.digitalocean.com/community/tutorials/understanding-arrow-functions-in-javascript You learned that arrow functions are always anonymous

https://www.digitalocean.com/community/tutorials/how-to-define-functions-in-javascript Arrow functions are always anonymous functions

Hi, arrow functions declared with const/let are not anonymous.

const f = () => {}
console.log(f) // logs f

Cheers

taniarascia commented 2 years ago

You can write simply console.log(() => {}) and it is an anonymous function. So it is not correct to say "arrow functions are not anonymous anymore". It seems like the browser might be better at inferring a name based on the variable you assigned a function to. However, arrow functions can exist outside of being assigned to a variable.

taniarascia commented 2 years ago

Ah okay, thanks for the information! I didn't realize that changed since I wrote it. I don't have the ability to directly edit the DigitalOcean posts, however. I can update the version on my website when I get around to it.

taniarascia commented 2 years ago

I got a message in my inbox saying, "Not even saying hello or thanks, quite toxic, won't bother you anymore.". I don't see it here so I don't know where that went. The original message has also been updated to say "arrow functions declared with const/let are not anonymous" as opposed to the original "Hi, I believe arrow functions are not anonymous anymore." which I was responding to.

You're correct, I have a tendency to be rather grumpy when dealing with messages about how something in my articles is wrong. I have nearly 200 articles, and sometimes they get out of date and I get overwhelmed about the idea of having to update them. Other times, there was a misunderstanding and my original article wasn't incorrect so I get annoyed when someone posts a comment about it being incorrect, which reduces confidence in my articles for future readers.

However, I can be better about responding to people and having a more gracious and understanding tone when dealing with various comments, it's something I've wanted to work on and improve.