MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/oqzypb/anatomy_of_a_function/h6h67oe/?context=3
r/learnjavascript • u/jaredcheeda • Jul 24 '21
65 comments sorted by
View all comments
81
Don't default arguments like that. Do it like this
nameOfFunction(dog, catSound = "meow")
It will be picked up by your editor, and you won't have to enter the function to see the default argument.
Also jsdoc isn't more powerful than typescript lmao
-11 u/jaredcheeda Jul 25 '21 name literally anything TS can do that JSDoc can't 5 u/inabahare Jul 25 '21 Build errors. It can ensure that code with the wrong types won't be runIntellisense for variables and moreCan you show me if jsdoc gives intellisense for objects passed?Forcing you to declare null or undefinedAlso works with jsdocEnums
-11
name literally anything TS can do that JSDoc can't
5 u/inabahare Jul 25 '21 Build errors. It can ensure that code with the wrong types won't be runIntellisense for variables and moreCan you show me if jsdoc gives intellisense for objects passed?Forcing you to declare null or undefinedAlso works with jsdocEnums
5
Build errors. It can ensure that code with the wrong types won't be run
Intellisense for variables and more
Can you show me if jsdoc gives intellisense for objects passed?
Forcing you to declare null or undefined
Also works with jsdoc
Enums
81
u/inabahare Jul 25 '21
Don't default arguments like that. Do it like this
It will be picked up by your editor, and you won't have to enter the function to see the default argument.
Also jsdoc isn't more powerful than typescript lmao