← CodeClarityLab Home
Browse by Category
+ added · updated 7d
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Fetch API ES2015
The browser-native Promise-based API for making HTTP requests — replacing XMLHttpRequest with a cleaner interface supporting streaming, CORS, and request/response objects.
4w ago javascript beginner
Array.flat() & Array.flatMap() ES2019
Array.flat(depth) flattens nested arrays; Array.flatMap() maps then flattens one level — more efficient than map().flat() and great for expanding items.
2mo ago javascript beginner
Clipboard API HTML5
The async Clipboard API (navigator.clipboard) is the modern replacement for document.execCommand('copy') — supports text, images, and rich content with proper permission handling.
2mo ago javascript beginner
Error.cause — Error Chaining ES2022
ES2022 added a cause option to the Error constructor — 'new Error('message', { cause: originalError })' — enabling proper error chaining where a high-level error wraps its underlying cause, preserving the full error context across abstraction layers.
2mo ago javascript beginner
Geolocation API HTML5
navigator.geolocation provides GPS/network location data — requires HTTPS, user permission, and graceful fallback handling for denial or unavailability.
2mo ago javascript beginner
Page Visibility API HTML5
The Page Visibility API tells you when a tab is hidden or visible — use it to pause animations, polls, and video when the user switches tabs.
2mo ago javascript beginner
toSorted / toReversed / with — Immutable Array Methods ES2023
JavaScript ES2023 adds immutable counterparts to mutating array methods: toSorted() returns a sorted copy, toReversed() returns a reversed copy, and with(index, value) returns a copy with one element replaced — none mutate the original array.
2mo ago javascript beginner
Web Share API HTML5
navigator.share() invokes the native OS share sheet on mobile — letting users share URLs, text, and files via any app installed on their device.
2mo ago javascript beginner
NaN — Detection & Avoiding Pitfalls ES2015
NaN is the only JavaScript value not equal to itself — use Number.isNaN() (not isNaN()) to detect it, as isNaN() coerces its argument first.
2mo ago javascript beginner
ReferenceError — Undefined Variables ES2015
ReferenceError is thrown when accessing a variable that hasn't been declared — unlike undefined which is a declared variable with no value.
2mo ago javascript beginner
SyntaxError — Parse-Time Failures ES5
SyntaxError means JavaScript couldn't parse your code — the entire script fails to execute. Common causes: missing brackets, invalid JSON, reserved word misuse.
2mo ago javascript beginner
TypeError — Common Causes and Fixes ES5
TypeError is thrown when a value is not of the expected type — most commonly 'Cannot read properties of undefined/null', the most frequent JavaScript runtime error.
2mo ago javascript beginner
typeof Checks and the null Quirk ES5
typeof returns a string describing the type — but typeof null === 'object' is a famous historical bug that cannot be fixed without breaking the web, requiring explicit null checks alongside typeof.
2mo ago javascript beginner
undefined vs null — Subtle Differences ES5
undefined means 'not yet assigned' (declared but empty); null means 'intentionally absent' — they're different values but both falsy, and typeof null === 'object' is a famous JS bug.
2mo ago javascript beginner
DOM Manipulation ES5
querySelector, createElement, innerHTML — reading and modifying PHP-rendered HTML from JavaScript.
2mo ago javascript beginner
JSON.parse & JSON.stringify ES5
JSON.stringify converts JS objects to JSON strings; JSON.parse converts them back — direct counterpart to PHP's json_encode/json_decode.
2mo ago javascript beginner
Nullish Coalescing (??) & Logical Assignment ES2020
?? returns the right side only when the left is null or undefined — unlike ||, it does not trigger on 0 or empty string. Parallel to PHP's null coalescing operator.
2mo ago javascript beginner
package.json & npm — Alongside composer.json npm3
package.json manages JS dependencies and build scripts for PHP projects using JavaScript — the npm counterpart to Composer.
2mo ago javascript beginner
Spread & Rest Operators ES2015
Spread (...) expands iterables into arguments or array/object literals; rest (...) collects remaining arguments into an array.
2mo ago javascript beginner
Template Literals ES2015
Backtick strings with ${expression} interpolation — the JavaScript equivalent of PHP's double-quoted strings and heredoc.
2mo ago javascript beginner
✓ schema.org compliant