What's the difference between reloading and rewriting?

look up the data and say that overloading refers to methods with the same name and different parameters but different requirements, so JS does not overload (Java has)

what"s the difference between rewriting and reloading JS?

May.12,2022

without much to say, the image above
overload means that the function name is the same, but the parameters are different
rewriting means overwriting. It is generally used for subclasses to override the methods of the parent class

The function of

js is essentially a variable. So there is no overloading, only rewriting (overwriting). There is a variable declaration promotion in js. So the function declared later overrides the previous one.

function sum(a,b){return a+b}   //  sum
console.log(sum);  // 
console.log(sum(1,2))  // NaN
function sum(a,b,c){return a+b+c;}  //  sum
console.log(sum);
console.log(sum(1,2,3))

clipboard.png


JS is not overloaded. JS can understand that everything is an object, var a = function () {alert (1)}, where an is just a reference to function () {alert (1)}, when you rewrite, a = function () {alert (2)}, then the reference to a points to function () {alert (2)} and cannot call alert (1), so JS can only rewrite it.
Java is a strongly typed language. Different methods can be found according to the type and number of parameters passed in, so Java is overloaded.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea8126-1ea8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea8126-1ea8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?