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:
const n = 0.0000005;
console.log(typeof n);
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”.
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:
const n = 0.0000005; console.log(typeof n);
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”.