document.write("") / console.log() (推薦)// 單行、/* 多行 */document → html → (head, body)window → (navigator, screen, history, location, document)document.getElementById("id").value.toUpperCase() / .toLowerCase()parseInt(), parseFloat(), Number(), +strString(num), num.toString(), ""+num.length+、+=、模板字符串 \`\${var}\`== (類型轉換)、=== (嚴格)、!=, !==, >, >=, <, <=const (首選)、let、var (避免)if/else、三元 ? :、switchfor, while, do-while, for...of (可迭代), for...in (鍵名)function fn() {}、函數表達式 const fn = () => {}function fn(a=1) {}function fn(...args) {}const [a,b] = arr; const {x,y} = obj;(() => {})() 創建隔離作用域this 綁定:默認/隱式/顯式 (call/apply/bind)/new/箭頭函數繼承外層"use strict" 禁止隱式全局、this 指向 undefined 等export/import (ESM)、module.exports/require (CommonJS)try/catch/finally, throw new Error()document.getElementById, querySelector, querySelectorAlldocument.createElement, createTextNode, createDocumentFragmentappendChild, insertBefore, prepend, append, before, after, replaceWithremove(), parent.removeChild(child)cloneNode(true) (深複製含事件/子孫)getAttribute, setAttribute, removeAttribute, hasAttribute, datasetclassList.add/remove/toggle/contains/replaceelement.style.prop = val, cssText, getComputedStyle(el)textContent (安全、快), innerHTML (解析 HTML, 風險), innerText (渲染後文本, 慢)parentNode, children, firstElementChild, nextElementSiblingaddEventListener(type, handler, options), removeEventListener, event.preventDefault(), stopPropagation(), event.target, currentTargetif (e.target.matches(".child"))form.elements, form.submit(), form.reset(), input.value, input.checkValidity(), reportValidity()Selection, Range, execCommand (棄用)scrollTo, scrollBy, scrollIntoView, scrollTop/LeftgetBoundingClientRect(), offsetWidth/Height, clientWidth/Height, scrollWidth/Heightwindow.open/close, opener, parent, top, self, frameslocation.href/replace/assign/reload, location.search/hash/pathname, URLSearchParamshistory.pushState/replaceState/go/back/forward, popstate 事件navigator.userAgent, navigator.geolocation, navigator.onLine, navigator.clipboardscreen.width/height, availWidth/Height, colorDepthlocalStorage/sessionStorage (同源、5MB、同步)、IndexedDB (異步、大容量)Cookie:document.cookie、HttpOnly、Secure、SameSitesetTimeout/clearTimeout, setInterval/clearInterval, requestAnimationFrame/cancelAnimationFramePromise, async/await, fetch, XMLHttpRequest (舊)fetch 基礎:fetch(url, {method, headers, body}).then(r=>r.json())window.onerror, unhandledrejection 事件performance.now(), performance.mark/measure, PerformanceObservernew Worker("worker.js"), postMessage, onmessage, SharedArrayBuffernew WebSocket(url), send, onmessage, closegetContext("2d"), 繪製路徑、圖片、文字、變換getContext("webgl"), 三維渲染、著色器https://www.w3.org/2000/svg, 矢量圖形FileReader, Blob, URL.createObjectURL, 拖拽上傳function debounce(fn, ms) { let t; return (...a) => { clearTimeout(t); t = setTimeout(() => fn.apply(this, a), ms); }; }function throttle(fn, ms) { let last = 0; return (...a) => { const now = Date.now(); if (now - last >= ms) { last = now; fn.apply(this, a); } }; }JSON.parse(JSON.stringify(obj)) (不含函數/循環引用) / structuredClone(obj) (現代)Array.isArray, Object.prototype.toString.call[...new Set(arr)]arr.flat(Infinity){...a, ...b} (淺合併)obj?.prop?.()a ?? b (a 為 null/undefined 才用 b)a ||= b, a ??= b, a &&= bclass { #priv = 1; getPriv() { return this.#priv; } }@decorator class {}await fetch()import("./module.js").then(m => ...)customElements.define, Shadow DOM, HTML Templatesnew Intl.DateTimeFormat, NumberFormat, RelativeTimeFormat, PluralRulesmatch (val) { when ... }不要死記 106 條。建立知識圖譜:語言核心 → DOM/BOM → 異步/模組 → 工程化/工具鏈 → 新提案。實戰中遇到查閱,形成肌肉記憶。MDN Web Docs 是最權威、最新的參考手冊。