You can give links names to make the body markdown easier to read
You can give [links][example_link] names to make the body markdown easier to read
[example_link]:EXAMPLE.md
You can give links names to make the body markdown easier to read
You can give [links][example_link] names to make the body markdown easier to read
[example_link]:EXAMPLE.md
| // put this in key event - key 229 is legacy (older browser send different 'key' for return while composing) | |
| if (e.isComposing || e.keyCode === 229) return; | |
| // safe to submit here if you want | |
| // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing |
| const all = async arr => { | |
| const results = [] | |
| for (p of arr) results.push(await p) | |
| return results | |
| } |
| function makeFunction() { | |
| let myVar = 123 | |
| return function (s) { | |
| console.log(eval(s)) | |
| } | |
| } | |
| const func = makeFunction() |
| <!doctype html> | |
| <html lang="en"> | |
| <body> | |
| <script type="hash-module" id="sum"> | |
| export const sum = (a, b) => a + b; | |
| </script> | |
| <!-- All hash modules need to go before this script. --> | |
| <!-- This cant be a type="module", it must be executed immediately. --> | |
| <script> |
| export function observePosition(element, callback) { | |
| const trackDiv = document.createElement("div") | |
| Object.assign(trackDiv.style, { | |
| position: "fixed", | |
| pointerEvents: "none", | |
| width: "2px", | |
| height: "2px", | |
| }) | |
| if (element.children.length) { | |
| element.insertBefore(trackDiv, element.firstChild) |
| const arr = [1, 2, 3, 4] | |
| const handler = { | |
| get(target, prop, receiver) { | |
| // try to convert property to a number | |
| const n = +prop | |
| // if it's a number less than zero, return the correct item from the array | |
| if (!isNaN(n) && n<0) { | |
| return Reflect.get(target, target.length + n, receiver) | |
| // otherwise continue as normal with the property |
| // pass in 2 letter country code | |
| const getFlagEmoji = countryCode=>String.fromCodePoint(...[...countryCode.toUpperCase()].map(x=>0x1f1a5+x.charCodeAt())) |
| const fib = n => { | |
| const r5 = fib.r5 || (fib.r5=5**.5) | |
| return Math.floor((((1+r5)/2)**n - ((1-r5)/2)**n)/r5) | |
| } |
| const isPalindrome = ([...s]) => ''+s == s.reverse() |