The mechanism of using variables and functions before their declarations by moving their declarations at the top of the code is called as hoisting in Javascript.
Example:
<!DOCTYPE html> <html> <head> </head> <body> <script> document.write(mul(2,5,6)); function mul(a,b,c) { return a*b*c; } </script> </body> </html> |
Output:
60 |
Please Share