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: 2020-01-09T06:30:27+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements