Tips & Tricks #13
Can I run snippet of code in devtools?
Chrome, Edge, Opera
Sources > In the left sidebar, open Snippets > Click "+ New snippet". This will open an empty file in the main view.
Enter the snippet and press
Cmd+Enterto run the code.
Open Console (
Ctrl+Shift+K) > Switch to multi-editor mode (
This will open the editor next to the Console, where you can enter the snippet and click "Run" to execute.
In Sources > Click the "+" button to Create Resource > "Console Snippet...". Input the name of the snippet and enter the script.
Click the Play button next to the snippet name to execute the code in Console.