List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
| const div = document.querySelectorAll("div"); | |
| console.dir(div); // it's NodeList | |
| Array.from(div); // return Array or | |
| [...div]; // return Array |
| let str = "i am in the programer"; | |
| str = str.split(" "); | |
| for (let i = 0; i < str.length; i++) { | |
| str[i] = str[i][0].toUpperCase() + str[i].substr(1); | |
| } | |
| console.log(str.join(" ")); | |
| ////// I Am In The Programer |
| let val = 0.6 + 0.7; | |
| console.log(+val.toFixed(1)); // 1.3 |
| const arr = ["black", "white", "yellow", "purple", "grean"]; | |
| const val = Math.floor(Math.random() * arr.length); | |
| console.log(val, arr[val]); |
| { | |
| "cars": [ | |
| { | |
| "url": "desktopwallpapers.org.ua/mini/201507/40069.jpg", | |
| "name": "CHEVROLET", | |
| "id": 1, | |
| "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", | |
| "date": 1422153200637 | |
| }, | |
| { |
| function validateEmail(email) { | |
| const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| return re.test(String(email).toLowerCase()); | |
| } |
| Keymap (Windows Users): | |
| [ | |
| { "keys": ["alt+shift+f"], "command": "reindent" }, | |
| ] | |
| Settings: | |
| { | |
| "show_definitions": false, | |
| "auto_complete": false, | |
| "bold_folder_labels": true, |