--- title: Debugging --- - `@debug` - `$inspect` Svelte provides two built-in ways to debug your application. ## `$inspect` TODO ## @debug ```svelte {@debug} ``` ```svelte {@debug var1, var2, ..., varN} ``` The `{@debug ...}` tag offers an alternative to `console.log(...)`. It logs the values of specific variables whenever they change, and pauses code execution if you have devtools open. ```svelte {@debug user}

Hello {user.firstname}!

``` `{@debug ...}` accepts a comma-separated list of variable names (not arbitrary expressions). ```svelte {@debug user} {@debug user1, user2, user3} {@debug user.firstname} {@debug myArray[0]} {@debug !isReady} {@debug typeof user === 'object'} ``` The `{@debug}` tag without any arguments will insert a `debugger` statement that gets triggered when _any_ state changes, as opposed to the specified variables.