List of helpful shortcuts for faster coding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exponentiation | |
Math.pow(2,3); | |
console.log(2 ** 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Trailing Commas | |
const Students = { | |
first: '1', | |
second: '2', | |
third: '3', | |
} | |
const Student = [1,,2,,3,,,]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MAP and SET method of array in JavaScript | |
// Set removes all duplicate elements from the array | |
const array = [1,2,3,4,5,5,5,1,1,2,4,2,6,3,7]; | |
const setArray = new Set(array); | |
// console.log(setArray); | |
const uniqueArray = [...setArray]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Object Values and Object Entries | |
const Employes = { | |
name: 'Manav', | |
age: '21', | |
contact: ['9662260013','[email protected]'], | |
callme: function(){ | |
return this.name + this.age; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// padStart and padEnd | |
const String = '12345678'; | |
// padStart will add string/padding at the start to justify the Required Length | |
console.log(String.padStart(10,'.')); | |
// Output :- ..12345678 | |
// padEnd will add string/padding at the end to justify the Required Length | |
console.log(String.padEnd(10,'.')); | |
// Output :- 12345678.. |
- Install the Prettier from extentions
- Open you code
- Then Press
On Windows
Shift + Alt + F
On MacShift + Option + F
On UbuntuCtrl + Shift + I
- Thats it..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myDate = new Date().getUTCDate(); | |
const myMonth = new Date().getUTCMonth()+1; | |
const myYear = new Date().getUTCFullYear(); | |
const date = myDate.toString() | |
const month = myMonth.toString() | |
const year = myYear.toString() | |
console.log(date + "-" + month + "-" + year) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file.mimetype.substr(6) |
OlderNewer