Running JavaScript snippets with Chrome Dev Tool
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.
Follow these steps to create your first snippet:
- Open dev tools in chrome: Press command+option+J(on mac) and ctrl+shift+J (on non mac)
- Click on
sources
tab to opensource panel
.page
sub-tab will be open by default. - Click on
more tabs
and selectsnippet
. - Click
new snippet
and give your snippet some name. - Select the name of your snippet from the tab on
snippet pane
. - Start writing your code as you would write in console.
You can run the snippet by entering ctrl+enter
or command+enter
in mac.
Also you can access the code directly from console like
So, next time when you’re developing something and constantly need to write code on console, try making use of snippet
.