Skip to content

Instantly share code, notes, and snippets.

View rajat2502's full-sized avatar
🏠
Working from home

Rajat Verma rajat2502

🏠
Working from home
View GitHub Profile
@rajat2502
rajat2502 / vscode_shortcuts.md
Created November 4, 2019 13:39 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@rajat2502
rajat2502 / multiply ES5
Created May 2, 2020 17:06
ES6 features
function multiply(num1, num2) {
return num1 * num2;
}
function multiply(num1, num2) {
return num1 * num2;
}
const multiply = (num1, num2) => {
return num1 * num2;
}
// Single line arrow function
const multiply = (num1, num2) => num1 * num2;
const myFunction = () => ({ value: 'test' })
myFunction()
// returns: { value: 'test' }
// without parentheses - single arguement
const doubleNumber = num => num * 2;
// In ES5
var obj = {
id: 1,
printId: function printId() {
setTimeout(function() {
console.log(this.id);
}.bind(this), 1000)
}
}
// In ES5, bind(this) is required to pass the context of the function
var name = 'World';
var message = 'Hello ' + name;
console.log(message);
// prints: Hello World
const name = 'World';
const message = `Hello ${name}`;
console.log(message);
// prints: Hello World