CodeNewbie Community ๐ŸŒฑ

udenewu chinonso
udenewu chinonso

Posted on

a little help๐Ÿ’

hey guys! who knows how to "console.log" shortcut
its quite fustrating writing it multipe times

Top comments (1)

Collapse
 
terabytetiger profile image
Tyler V. (he/him)

If you're using VS Code you can use Ctrl + Shift + Pand search for "User Snippets" and select "Preferences: Configure User Snippets"

Select JavaScript to create a shortcut file and add this to the contents:

{
  "Console Log": {
    "scope": "javascript, typescript",
    "prefix": ["clg"],
    "body": "console.log($1)",
    "description": "Console log statement"
  }
}

Enter fullscreen mode Exit fullscreen mode

This creates a shortcut of clg which maps to console.log() and inserts your cursor between the parenthesis (The $1 location). You can also add multiple strings in the prefix array if you'd like to set multiple shortcuts to the same thing.

When creating more shortcuts, you can use $1, $2, $3, etc... to quickly be able to tab through to multiple spots :)