OMBD#6: Running Code Snippets on Chrome’s Console

A quick guide for web developers on this great time-saver when executing JavaScript on the go.

Jon Portella
Mar 2 · 3 min read

Welcome to issue #6 of One Minute Better Developer, where you become a more successful software developer by reading short nuggets of knowledge, one minute at a time.

🔛 ⏭️

THE PROBLEM

You want to test a registration form on a website. Instead of filling it up manually every time, you may come up with a snippet like this that does it automatically for you:

Now, instead of copy-pasting it over and over, it would be great if we could store it on the browser so when we want to use it we can retrieve it and run it easily.

A SOLUTION

Fortunately, Chrome’s DevTools provide functionality for this: snippets.

  1. Open Chrome’s DevTools.

2. Press ctrl/cmd + shift + p to show Chrome’s DevTools command menu:

3. Type “show snippets” and select that option

4. This will reveal the Snippets tab under the sources panel.

Tap on + New snippet

5. Name your snippet and input its content on the right-hand panel.

Now that your snippet is saved, you can press ctrl/cmd + enter to run it on the page!

Snippets will persist between browser sessions, so you can retrieve and run them easily.

BONUS: here’s a list of snippets to get you inspired.

Frontend Weekly

It's really hard to keep up with all the front-end…

Jon Portella

Written by

Full-Stack Developer, Teacher, Maker, and general Things-Doer. https://www.linkedin.com/in/jonportella/

Frontend Weekly

It's really hard to keep up with all the front-end development news out there. Let us help you. We hand-pick interesting articles related to front-end development. You can also subscribe to our weekly newsletter at http://frontendweekly.co

Jon Portella

Written by

Full-Stack Developer, Teacher, Maker, and general Things-Doer. https://www.linkedin.com/in/jonportella/

Frontend Weekly

It's really hard to keep up with all the front-end development news out there. Let us help you. We hand-pick interesting articles related to front-end development. You can also subscribe to our weekly newsletter at http://frontendweekly.co

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store