Manuals & specifications
Learn where JavaScript developers find reliable answers: MDN reference pages, the ECMAScript specification, Baseline labels, compatibility tables, and how to read a reference entry.
- 01Choose the right sourceUse MDN for friendly reference pages, the spec for exact rules, and compatibility data for browser support.
- 02Read a reference entryFind syntax, parameters, return values, examples, specs, and compatibility without getting lost.
- 03Predict real behaviorTrace Array.prototype.at from friendly docs down to the important spec steps.
Reliable answers beat lucky guesses
JavaScript is too big to memorize. Professional developers do not keep every method, edge case, and browser version in their heads. They learn where to find trustworthy answers, how to read them quickly, and when to verify a detail with a small experiment.
In A short history of JavaScript, you met ECMAScript: the standard maintained by Ecma TC39, with ES5, ES2015, and yearly releases. In Engines, runtimes & hosts, you met the split between language features and host APIs. This lesson turns that into a practical skill: when you ask “what does this JavaScript do?” you need the language manual; when you ask “does this browser have it?” you need compatibility data; when you ask about the DOM, you may need host specifications such as WHATWG HTML or DOM.
Start with MDN Web Docs for a friendly explanation. Drop to the ECMAScript specification at tc39.es/ecma262 when exact language rules matter. Check Baseline, MDN browser compatibility tables, caniuse.com, or web.dev Baseline when support matters.
If you buy a tool, you read the manual first. If two builders disagree, they check the building code. If you plug in a charger, you check the “works with” label. JavaScript has the same three layers of reference.
- In real life: A friendly user manual
- In JavaScript: MDN explains what a feature is for, with examples
- In real life: A building code or law
- In JavaScript: The ECMAScript spec gives official rules engines must follow
- In real life: A label saying which charger works
- In JavaScript: Compatibility data says which browsers support a feature
Where the analogy stops: A building code can still be read by people, and MDN can be precise. The point is purpose: MDN teaches use; the spec defines exact behavior; compatibility data answers support.
We will use Array.prototype.at() as the running example because it is small, useful, and full of teachable details: negative indexes, out-of-range results, specification steps, and browser support.
MDN reference pages
REFERENCE MAPMDN Web Docs is usually your first stop. A good reference page answers four beginner questions quickly: “how do I call it?”, “what do the inputs mean?”, “what comes back?”, and “can I see examples?”. It also points deeper: specification links and browser compatibility tables live near the bottom of many reference pages.
Do not read a reference page like a novel from top to bottom every time. Use it like a dictionary. Jump to the section that answers your question, then read surrounding notes if the answer depends on edge cases.
Array.prototype.at(index) Syntax at(index) Parameters index: Zero-based position to read. Negative values count back from the end. Return value The element at that position, or undefined when the position is outside the array. Description Does not change the array. Converts the index to an integer before choosing. Examples [10, 20, 30].at(0) // 10 [10, 20, 30].at(-1) // 30 Specifications ECMAScript language specification: Array.prototype.at Browser compatibility Check the compatibility table before depending on it in older browsers.Start here to learn the shape of the call. at(index) says the method needs one value named index.
This simplified entry is modeled on MDN’s common layout, but the wording is ours. Notice the pattern: a concise summary, a syntax line, parameters, a return value, description details, examples, a specification link, and compatibility information. When a method surprises you, the return value and description sections are often the fastest fix.
You rarely read a recipe card in order when you are checking one detail. If you wonder “does this contain nuts?”, you jump to the allergy note. If you wonder “how long in the oven?”, you jump to the step. Reference pages work the same way.
- In real life: Ingredients
- In JavaScript: Parameters: what values the method needs
- In real life: Cooking steps
- In JavaScript: Description and examples: how the method behaves
- In real life: Serves four
- In JavaScript: Return value: what you get back
- In real life: Allergy label
- In JavaScript: Compatibility notes: whether your environment can use it
Where the analogy stops: A recipe tells a human cook what to do. A reference entry describes code that an engine already knows how to run.
The ECMAScript specification
STEP THROUGHThe ECMAScript specification is the official rulebook for the JavaScript language: values, syntax, objects, functions, arrays, promises, modules, and many built-in methods. Engine teams use it to make V8, SpiderMonkey, JavaScriptCore, and other engines agree. It is not where most beginners should start, but it is the source of truth for exact behavior.
Specifications are written in careful algorithm steps. For Array.prototype.at(index), the important ideas are:
- Let
Obe? ToObject(this value). - Let
lenbe? LengthOfArrayLike(O). - Let
relativeIndexbe? ToIntegerOrInfinity(index). - If
relativeIndex ≥ 0, letkberelativeIndex. - Else, let
kbelen + relativeIndex. - If
k < 0ork ≥ len, returnundefined. - Return
? Get(O, ! ToString(𝔽(k))).
? and ! doing there?They are specification notation for how operations complete and how impossible failures are treated. They are not characters you type in this JavaScript call. You only need the big idea today; Stage 12 returns to spec notation in detail.
Here is a small real function that mirrors those big decisions for array-like values. It is not a full replacement for the spec, but it is close enough for the cases in this lesson, and the test suite compares it with real Array.prototype.at for negative zero, fractional indexes, strings, NaN, and out-of-range positions.
function simplifiedAt(array, index) { const object = Object(array); const length = object.length >>> 0; const relativeIndex = Math.trunc(Number(index)) || 0; const k = relativeIndex >= 0 ? relativeIndex : length + relativeIndex; if (k < 0 || k >= length) return undefined; return object[String(k)];}Choose an index, predict the return value, then follow the algorithm's big decisions.
script
const answer = simplifiedAt(letters, -1);console.log(answer);Two precise details are worth learning early. First, 1.7 becomes 1; it does not round to 2. Second, NaN behaves like 0 here. You do not have to memorize those rules today, but you should know where to find them when a bug depends on them.
Baseline & browser compatibility
LIVE CHECKThe spec can say what a feature means before every user has a browser that supports it. Compatibility data answers a different question: “where does this work?” MDN tables list browser versions and often include notes for partial support, flags, or old behavior. Caniuse.com is another common way to scan support for web-platform features.
Baseline is a simpler label for the modern web. Newly available means a feature is supported in the current versions of the core browsers: Chrome, Edge, Firefox, and Safari. Widely available arrives about 30 months after that cross-browser point. It is a traffic-light style shortcut, not a promise that every old browser is safe.
| Signal | What it tells you | What to still check |
|---|---|---|
| Baseline Newly available | Current core browsers support it | Whether your users are stuck on older versions |
| Baseline Widely available | It has had broad support for about 30 months | Embedded browsers, enterprise devices, and unusual runtimes |
| Version number | The first browser version with support | Whether your app supports older versions |
| Partial support | Some cases work, but not the whole feature | Notes describing the missing parts |
| Flag or preference | Users or developers had to turn it on | Do not rely on it for ordinary visitors |
typeof Array.prototype.at"toSorted" in Array.prototypetypeof Object.groupBytypeof structuredCloneA language method from ECMAScript. Most current browsers have it.
Array.prototype.at: checking in your browser after hydration. A language method from ECMAScript. Most current browsers have it.
Feature detection asks the browser you are actually running: “do you have this?” It is a useful runtime guard, but it does not replace planning. You still need compatibility data before choosing a feature for a production app, because your users may not have the same browser you do.
Reading a reference entry
INTERACTIVENow practice reading the small signals in a reference entry. A syntax line like at(index) tells you the method name and parameter names. A line like padStart(targetLength) / padStart(targetLength, padString) tells you there is a shorter form and a longer form; the second argument is optional, and the page explains the default.
at(index)padStart(targetLength)padStart(targetLength, padString)"7".padStart(3); // " 7""7".padStart(3, "0"); // "007"[10, 20, 30].at(-1); // 30The return value section matters just as much as the parameters. If .at() cannot find an element at the final position, it returns undefined; it does not throw an error. Step through a few real calls and connect each result back to the reference sections above.
Predict the value from the reference entry, then step through the real call.
script
const result = numbers.at(-1);console.log(result);This is the habit to build: read the syntax to make a valid call, read parameters to understand inputs, read return value before using the result, then read examples to check your model. If an example still surprises you, use the spec link or make a tiny experiment in your console.
Where would you look?
SORTEREach resource is reliable for a different kind of question. Sort these everyday developer questions by the place you would check first.
- I want a friendly explanation and examples of
Array.prototype.at(). - I need the exact step-by-step rule for a negative, fractional index.
- Can Safari 15 use
structuredClonewithout a fallback? - What does a method return when the requested item is missing?
- Two engines disagree; which one matches the official algorithm?
- Is a feature safe for the current versions of the core browsers?
Pick the best first stop. The explanations tell you why another source might come second.
Where you’ll use this
References are not only for trivia. You use them while writing everyday code. Suppose you are showing the last message in a list:
const lastMessage = messages.at(-1);
if (lastMessage === undefined) {
showEmptyState();
} else {
renderMessage(lastMessage);
}MDN helps you confirm that .at(-1) means “last item.” The return value section reminds you to handle undefined when the list is empty. Compatibility data tells you whether older target browsers need a fallback like messages[messages.length - 1]. The spec is there if a strange input, such as a fractional index, becomes important.
| Section | Best for | Beginner habit |
|---|---|---|
| Syntax | The shape of the call | Copy the shape, not the example blindly |
| Parameters | What each input means | Check optional inputs and defaults |
| Return value | What comes back | Read this before chaining another method |
| Description | Edge cases and mutation | Look for words like changes, returns, shallow, or throws |
| Examples | A quick mental model | Run a tiny version in your console |
| Specifications | Official exact behavior | Use when edge cases matter |
| Browser compatibility | Support by version | Check before using newer features |
Common misconceptions
“Real developers memorize the whole language.”
They memorize the big ideas and look up details. Knowing where to look is a professional skill, not a weakness.
“MDN is the specification.”
MDN is a reference written for people. It links to specifications, but the ECMAScript spec is the official language rulebook.
“If the spec has a feature, every browser supports it.”
Shipping takes time. Always check compatibility data when users might have older browsers.
“Baseline means old browsers are guaranteed.”
Baseline summarizes current and broadly available support. It does not remove the need to know your audience.
“The ECMAScript spec covers every web API.”
It covers the JavaScript language. Host APIs like the DOM live in other specs, such as WHATWG HTML and DOM.
The spec algorithms are not JavaScript source code, but they are precise enough that engine teams, test writers, and standards editors can discuss one step at a time.
Practice: read the reference
5 EXERCISESIn the modeled reference entry above, what does .at() return when the requested position is outside the array?
The return value section says an out-of-range position gives undefined. That is the value your code should handle.
.at() resultsWithout running it, predict the two console outputs.
console.log([10, 20, 30].at(-1));
console.log([10, 20, 30].at(5));The first line prints 30, the last item. The second line prints undefined, because index 5 is out of range.
In padStart(targetLength) / padStart(targetLength, padString), which parameter is optional?
console.log("7".padStart(3));
console.log("7".padStart(3, "0"));padString is optional. If you omit it, padStart pads with spaces; if you pass "0", it pads with zeroes.
Pick any newer feature, such as Array.prototype.toSorted or Object.groupBy. Where should you look to decide whether older browsers need a fallback?
Use MDN's browser compatibility table, caniuse.com, or Baseline information. The exact answer can change over time, so learn the checking habit rather than memorizing a number.
This code reads past the end of the array. What value should it handle before using item?
const item = ["first", "second"].at(2);
console.log(item);const item = ["first", "second"].at(2);
if (item === undefined) {
console.log("No item there");
}.at(2) returns undefined here. Check for that before treating the result like a real string or object.
Quiz: check your understanding
7 QUESTIONSYour score counts first tries. Read every explanation; wrong choices are designed to teach the boundary between MDN, the spec, and compatibility data.
Question 1 of 7Which source is usually the best first stop when you want human-friendly examples for a JavaScript method?
Choose an answer to see the explanation.
Question 2 of 7What does this print?
Read the code, then predictconsole.log([10, 20, 30].at(-1));Choose an answer to see the explanation.
Question 3 of 7In a syntax line like
padStart(targetLength, padString), what does an optional second parameter mean?Choose an answer to see the explanation.
Question 4 of 7What does this fractional-index call print?
Read the code, then predictconsole.log([10, 20, 30].at(1.7));Choose an answer to see the explanation.
Question 5 of 7What is Baseline Newly available meant to tell you?
Choose an answer to see the explanation.
Question 6 of 7Which source would you use to answer: can Safari 15 use
structuredClone?Choose an answer to see the explanation.
Question 7 of 7In spec algorithms, why does this lesson mention
?and!only lightly?Choose an answer to see the explanation.
Key takeaways
- MDN Web Docs is the friendly first stop for JavaScript reference pages, examples, and practical notes.
- The ECMAScript specification is the official rulebook for the language; host APIs like the DOM are specified elsewhere.
- Compatibility data answers support questions. Baseline Newly available means current core browsers support a feature; Widely available comes about 30 months later.
- Read reference entries by section: syntax, parameters, return value, description, examples, specifications, and browser compatibility.
- When a result matters, prove it with a tiny real program or test.
Remember the one-liner.
MDN teaches you how to use it, the spec defines exactly what it means, and compatibility data tells you where it works.
Up next: Setting up your tools — VS Code, the DevTools console, and Node.js.