2 ms·
In those cases I usually create a new function depending on the type. So for example I have a "main" function that does something with a date and expects a dat
by pier25 9y ago
In those cases I usually create a new function depending on the type.
So for example I have a "main" function that does something with a date and expects a date object:
doSomething(date)
And then if I want to pass a string I do something like:
doSomethingString(date) {
doSomething(new Date(date))
}