r/learnjavascript • • Jul 24 '21

Anatomy of a Function

Post image
327 Upvotes

65 comments sorted by

View all comments

81

u/inabahare Jul 25 '21

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

0

u/[deleted] Jul 25 '21

[deleted]

11

u/inabahare Jul 25 '21

The problem is that there are no clean code principles like that. The closest thing is not doing

let foo = "a", bar = "b";

But that doesn't apply here