This extension contains code snippets for JavaScript in ES6 syntax for Vs Code editor (supports both JavaScript and TypeScript).
In order to install an extension you need to launch the Command Pallete (Ctrl + Shift + P or Cmd + Shift + P) and type Extensions. There you have either the option to show the already installed snippets or install new ones. Search for JavaScript (ES6) code snippets and install it.
- JavaScript (.js)
- TypeScript (.ts)
- JavaScript React (.jsx)
- TypeScript React (.tsx)
- Html (.html)
- Vue (.vue)
Below is a list of all available snippets and the triggers of each one. The ⇥ means the TAB
key.
Trigger | Content |
---|---|
imp→ |
imports entire module import moduleName from 'module' |
ex→ |
export module export const name |
exd |
export module export default name |
exc |
export default class export default className {} |
Trigger | Content |
---|---|
fore→ |
forEach loop in ES6 syntax array.forEach(currentItem => {}) |
forof→ |
for ... of loop for(const item of object) {} |
forin→ |
for ... in loop for(const item in object) {} |
setinterval |
set interval helper method setInterval(() => {}); |
settimeout |
set timeout helper method setTimeout(() => {}); |
then→ |
adds then and catch declaration to a promise then((rs) => {) |
Trigger | Content |
---|---|
f |
Arrow Function (argument) => {} |
fn |
Function normal function name(argument) =>{} |
fa |
Async function async function(argument) {} |
fan |
async Arrow function async () => {} |
Trigger | Content |
---|---|
rqr |
require('package') |
Trigger | Content |
---|---|
clg→ |
console log console.log() |
clo→ |
console log variable with message console.log('variable :', variable); |
c→ |
console other console.() |