The meaning of life is to explore the world

JS has no overloading

Posted on By Jason Liu

JS has no overloading.
Instead, the later function overwrites the earlier ones.
E.g. In the codes below, the output will be no param.

class MyClass {
	f(text) { console.log(text); }
	f() {console.log('no param'); }
}
const myClass = new MyClass();
myClass.f('hello');