Skip to content

W3schools

Subscribe Youtube For Video Tutorials
  • Academics
    • Physics
    • Chemistry
    • Math
    • Biology
    • English
    • Hindi
  • Tutorials
    • Quartz scheduler
    • Log4j
    • JUnit
    • Java Mail
    • Java Generics
    • JAXB
    • Jsoup
    • JSON
    • XML Parser
    • Data structure
  • Java
    • Java
    • Collection framework
    • Java date time api
    • Java regex
    • Design patterns
  • Android
  • Servlet
    • JSP
  • Spring
    • Spring
    • Spring AOP
    • Spring DI
    • Spring MVC
    • Spring spel
    • Spring boot
    • Spring security
  • Hibernate
  • WS
    • Stories
  • Python
  • Web
    • Ajax
    • HTML
    • CSS
    • Javascript
    • jQuery
      • jQuery UI
    • PHP
    • TypeScript
    • ReactJS
    • Backbone.js
    • Bootstrap
      • Bootstrap 4
    • XML
      • XML DOM
      • XPath
      • XQuery
      • XSD
      • XSLT
  • Angular
    • AngularJS
    • Angular 7 Tutorial
    • Angular 8 Tutorial
  • DB
    • SQL
    • SQLite
    • MongoDB
    • MySQL
    • Oracle
    • PL/SQL
    • PostgreSQL
    • PouchDB
    • DBMS
  • C
  • More
    • Q&A
    • Quiz
    • Ant
    • CPP
    • JDBC
    • JPA
    • JSF
    • JAR
    • Maven
    • WAR
    • WordPress
  • Tools
    • Text Tools
    • Compare Tools
    • Encoder / Decoder
  • On This Day
  • Compilers
    • JSON

JavaScript Hoisting Example

JavaScript Hoisting

by

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>

Categories JavaScript Tags JavaScript Hoisting, JavaScript Hoisting Example, JavaScript Hoisting Syntax
[advanced_iframe src="https://www.onthisdayhistory.com/web-stories/top-9-priciest-wallets-ever-sold/" id="iframe1" name="iframe1" width="80%" height="450" ]
[advanced_iframe src="https://www.onthisdayhistory.com/web-stories/top-9-costliest-homes-in-connecticut/" id="iframe2" name="iframe2" width="80%" height="450" ]
[advanced_iframe src="https://www.onthisdayhistory.com/web-stories/top-9-priciest-jade-pieces-sold/" id="iframe3" name="iframe3" width="80%" height="450" ]
© 2025 W3schools • Built with GeneratePress