So in Java, you can
do:
void F(int x, int y)
{
run(x, y);
}
void F(String a) {
say(a);
}
but
in Javascript you always have to
do:
function F(x, y) {
if (typeof x == "string") {
say(a);
} else {
run(x,
y)
}
}
I
want to do something like the Java functions in Javascript without checking every single
thing, anyway to do that?
No comments:
Post a Comment