JavaScript Hoisting

The mechanism of using variables and functions before their declarations by moving their declarations to the top of the code is called 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>
Please follow and like us:
Content Protection by DMCA.com