Running JavaScript snippets with Chrome Dev Tool

Ishwar Rimal
2 min readJun 6, 2019

--

Do u keep writing code on console? Consider using code snippet option in chrome dev tools for all your repeated codes.

Code Snippet in Chrome Dev Tools

Follow these steps to create your first snippet:

  1. Open dev tools in chrome: Press command+option+J(on mac) and ctrl+shift+J (on non mac)
  2. Click on sources tab to open source panel. page sub-tab will be open by default.
  3. Click on more tabs and select snippet.
  4. Click new snippet and give your snippet some name.
  5. Select the name of your snippet from the tab on snippet pane.
  6. Start writing your code as you would write in console.
Calling the method from within the snippet

You can run the snippet by entering ctrl+enter or command+enter in mac.

Also you can access the code directly from console like

calling the method from console

So, next time when you’re developing something and constantly need to write code on console, try making use of snippet.

--

--

Ishwar Rimal
Ishwar Rimal

Written by Ishwar Rimal

Senior FrontEnd Engineer at Intuit. 8 years experience. I write articles on JavaScript, React, Web Optimisation, Startups, Work Life Balance, etc. ❤️ JavaScrip

No responses yet