this post was submitted on 05 May 2025
456 points (98.9% liked)
Programmer Humor
23030 readers
1999 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I think you confuse argument with parameter. You cannot specify the type of the parameter, but any argument you supply to a function in JS has a type. Every value in JS has a type, arguments included.
If I go:
The code above will print "number". And you cannot assign
n.foo = "metadata";
to this value of a primitive type. Not everything is an object.Either way, arguments have types, values have types. The arguments in this case were of type "number", when they should have been "string".