How to call a JavaScript Function from Chrome Console?


To call a JavaScript function from the console, run the following code:

Example

<!DOCTYPE html>
<html>
   <body>
      <script>
         var display = {
            displayOne: function(){ return "displayTwo" ;}
         };
         console.log(display.displayOne());
      </script>
   </body>
</html>

Updated on: 09-Jan-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements