Skip to content

Instantly share code, notes, and snippets.

@jswebschmiede
Last active November 19, 2022 12:58
Show Gist options
  • Save jswebschmiede/f2ccd2d5c12daafbe5aa804d44297ed2 to your computer and use it in GitHub Desktop.
Save jswebschmiede/f2ccd2d5c12daafbe5aa804d44297ed2 to your computer and use it in GitHub Desktop.
Javascript Snippets Json
{
"Arrow Function": {
"prefix": "arrow",
"body": ["const $1 = () => {", "$0", "}"],
"description": "Arrow Function"
},
"Fetch": {
"prefix": "fetch",
"body": [
"try {",
" const res = await fetch('$1');",
" const data = await res.json();",
"",
"} catch (err) {",
" console.error(err);",
"}"
],
"description": "Fetch"
},
"Get Element by Id": {
"prefix": "getid",
"body": ["const $el = document.getElementById('$el');"],
"description": "Get Element by Id"
},
"Add Event Listener": {
"prefix": "addevent",
"body": ["$1.addEventListener('$2', (e) => {", " $0", "});"],
"description": "Add Event Listener"
}
}
@jswebschmiede
Copy link
Author

Snippet Generator https://snippet-generator.app/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment