JavaScript Snippet
{ "Object-JS": { "prefix": "object-js", "body": [ "const obj = {", " str: '',", " bool: true,", " num: 1,", " list: ['str1', 'str2']", "}" ], "description": "Object JS" }, "If-Else-JS": { "prefix": "if-else-js", "body": [ "condition ? value1 : value2" ], "description": "If Else JS" }, "If-Else-If-JS": { "prefix": "if-else-if-js", "body": [ "condition1 ? value1 : ", "condition2 ? value2 : ", "condition3 ? value3 : value4" ], "description": "If ElsecIf JS" }, "While-JS": { "prefix": "while-js", "body": [ "while (condition) {", " // code", "}" ], "description": "While JS" }, "Do-While-JS": { "prefix": "do-while-js", "body": [ "do {", " // code", "} while (condition);" ], "description": "Do While JS" }, "For-JS": { "prefix": "for-js", "body": [ "for (begin; condition; step) {", " // code", "}" ], "description": "For JS" }, "Function-Arrow-JS": { "prefix": "function-arrow-js", "body": [ "let func = (arg1, arg2, argN) => {expression};" ], "description": "Function Arrow JS" }, "Function-Map-JS": { "prefix": "function-map-js", "body": [ "iterable.map((item: any) => {", " const {prop1, prop2} = item;", " return (", " <div>{prop1} {prop2}</div>", " // <div>{item.prop1} {item.prop2}</div>", " )", "})" ], "description": "Function Map JS" }, "Function Fetch JS": { "prefix": "function-fetch-js", "body": [ "const response = await fetch(", " `https://jsonplaceholder.typicode.com/posts?_limit=10`,", " );", " const data = await response.json();", " console.log(data);" ], "description": "Function-Fetch-JS" }, "Get-Element-ById-JS": { "prefix": "get-element-byid-js", "body": [ "const myElement = document.getElementById('myElement') as HTMLElement;" ], "description": "Get Element ById JS" }, "Select-Element-JS": { "prefix": "select-element-js", "body": [ "const myElement = document.querySelector('myElement') as HTMLElement;" ], "description": "Select Element JS" }, "Listen-Event-JS": { "prefix": "listen-event-js", "body": [ "myElement.addEventListener('click', async () => {", " // Code", "})" ], "description": "Listen Event JS" }}