{raw}
⤺ /text/dev/js

misc.txt

const getSelectedText = () => window.getSelection().toString();

div.querySelector('.x').onclick = ..

this.parentElement.parentElement.classList.add('x');

window.addEventListener("DOMContentLoaded", function() { });
el.removeEventListener()

el.scrollIntoView({behavior: 'smooth', block: 'center'});

.closest()

this.parentNode

el.querySelector("")
el.querySelectorAll("")


el.classList.remove("")
el.classList.add("")




// old school
var req = new XMLHttpRequest();
req.addEventListener("load", function() { });
req.open("GET", "/x");
req.send();

// new school
fetch('/x').then(response => {
  response.status ..
  response.json().then(data => { };
  response.text()
});

fetch('/x', { method: 'post', headers: { ... }, body: '', credentials: 'include' }).then ...

window.addEventListener("scroll", ... );

document.body.scrollHeight
window.innerHeight
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

document.createElement("div");
el.parentNode.insertBefore(new, el);

els = document.querySelectorAll(".thing");
els[els.length - 1]
els.getAttribute()




const user = {
    id,
    blogs: count,
    name,
}

user.id == id


const d = { a: 1, b: 2, c: 3 }
const { a, b, c } = d

const [a, b] = [1, 2]

a?.b?.c


a = [1, 2, 3]
b = [5, 6]
c = [0, ...a, 4, ...b]

a = {a: 1, b: 2}
b = {c: 3}
c = {...a, ...b, d: 4}

function x(a, b, ...rest) { }

const {a, ...b} = object

map, filter, reduce, sort, includes, slice, splice

export { a, b };

export { a as default, ... };
export default ...;


tcp.rip