![Sofia Emelianova](https://web.dev/images/authors/sofiayem.jpg) Sofia Emelianova [GitHub](https://github.com/sofiayem)

<br />

Use **Snippets** in DevTools to run code you frequently use and live expression to watch JavaScript values in real time.

[Video](https://www.youtube.com/watch?v=zW9ibQbYJNE)

Watch the video to learn how to:

- Create a snippet or open the **Snippets** pane:

  - With the [Command Menu](https://developer.chrome.com/docs/devtools/command-menu.md.txt)
  - In [**Sources** \> **Snippets**](https://developer.chrome.com/docs/devtools/javascript/snippets.md.txt#open).
- Run your new snippet:

  - With the <kbd>Command</kbd> / <kbd>Control</kbd> + <kbd>Enter</kbd> shortcut in **Sources**
  - From the [Command Menu](https://developer.chrome.com/docs/devtools/command-menu.md.txt#help) using `!`.
- Pass values to your snippet:

  1. Pause it with a [breakpoint](https://developer.chrome.com/docs/devtools/javascript/breakpoints.md.txt#loc).
  2. Set values in the [**Sources** \> **Scope**](https://developer.chrome.com/docs/devtools/javascript/reference.md.txt#scope) pane.
  3. Resume execution.
- Execute snippets from the **Console**: load them as global functions and run once.

- Use [Console Utilities API](https://developer.chrome.com/docs/devtools/console/utilities.md.txt) in your snippets.

- Use [**Console** \> **Live Expressions**](https://developer.chrome.com/docs/devtools/console/live-expressions.md.txt):

  - To execute a piece of code you want to run repeatedly, for example, during a debugging session.
  - Watch how the values change during execution in real time.

To learn more, see:

- [Run commands in the Command Menu](https://developer.chrome.com/docs/devtools/command-menu.md.txt)
- [Run snippets of JavaScript](https://developer.chrome.com/docs/devtools/javascript/snippets.md.txt)
- [Console Utilities API reference](https://developer.chrome.com/docs/devtools/console/utilities.md.txt)
- [Watch JavaScript values in real time with Live Expressions](https://developer.chrome.com/docs/devtools/console/live-expressions.md.txt)