cf.completefrontendCode editorOpen lab
THE JAVASCRIPT FIELD GUIDE

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.

By the end, you can
  • 01
    Choose the right sourceUse MDN for friendly reference pages, the spec for exact rules, and compatibility data for browser support.
  • 02
    Read a reference entryFind syntax, parameters, return values, examples, specs, and compatibility without getting lost.
  • 03
    Predict 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.

The map for this lesson

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.

Real-life analogyMDN is a user manual; the spec is the building code

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 MAP

MDN 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.

Explore a reference entry
Modeled reference entryReference
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.
Try it yourself

Start here to learn the shape of the call. at(index) says the method needs one value named index.

This is a simplified entry modeled on MDN's layout, with original wording for this lesson. It is not a copy of MDN.

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.

Real-life analogyA reference entry is a recipe card

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 THROUGH

The 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:

  1. Let O be ? ToObject(this value).
  2. Let len be ? LengthOfArrayLike(O).
  3. Let relativeIndex be ? ToIntegerOrInfinity(index).
  4. If relativeIndex ≥ 0, let k be relativeIndex.
  5. Else, let k be len + relativeIndex.
  6. If k < 0 or k ≥ len, return undefined.
  7. Return ? Get(O, ! ToString(𝔽(k))).
What are ? 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.

A small spec-shaped helperPop out in the code editor (opens in a new tab)JavaScript
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)];}
Follow the spec-shaped algorithm
Step 0 of 7Ready
Your turn: follow the blue line

Choose an index, predict the return value, then follow the algorithm's big decisions.

Running in
  1. script
Next: line 1
Click the blue line to take the next stepPop out in the code editor (opens in a new tab)JavaScript
const answer = simplifiedAt(letters, -1);console.log(answer);
CallStoreChangeResultRun = next line. Ran = already executed.
Recent returnsNothing yet. Start with the blue line.
Choose the index passed to simplifiedAt

The function is small real JavaScript, and tests compare it with real Array.prototype.at for the edge cases shown here.

A guided replay recorded from real JavaScript calls, not an engine debugger. Step follows executed statements; Back reviews a snapshot. Reset starts a fresh run.

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 CHECK

The 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.

How to read compatibility signals
SignalWhat it tells youWhat to still check
Baseline Newly availableCurrent core browsers support itWhether your users are stuck on older versions
Baseline Widely availableIt has had broad support for about 30 monthsEmbedded browsers, enterprise devices, and unusual runtimes
Version numberThe first browser version with supportWhether your app supports older versions
Partial supportSome cases work, but not the whole featureNotes describing the missing parts
Flag or preferenceUsers or developers had to turn it onDo not rely on it for ordinary visitors
Feature detection in this browser
Feature checksPop out in the code editor (opens in a new tab)JavaScript
typeof Array.prototype.at"toSorted" in Array.prototypetypeof Object.groupBytypeof structuredClone
ResultArray.prototype.at
checking in your browser after hydration

A language method from ECMAScript. Most current browsers have it.

Try it yourself

Array.prototype.at: checking in your browser after hydration. A language method from ECMAScript. Most current browsers have it.

This is real feature detection in your browser. It is separate from server rendering, so the lesson never guesses before the page reaches you.

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

INTERACTIVE

Now 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.

Syntax linesReference
at(index)padStart(targetLength)padStart(targetLength, padString)
"7".padStart(3);       // "  7""7".padStart(3, "0");  // "007"[10, 20, 30].at(-1);    // 30

The 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.

Step through real .at() calls
Step 0 of 3Ready
Your turn: follow the blue line

Predict the value from the reference entry, then step through the real call.

Running in
  1. script
Next: line 1
Click the blue line to take the next stepPop out in the code editor (opens in a new tab)JavaScript
const result = numbers.at(-1);console.log(result);
CallStoreChangeResultRun = next line. Ran = already executed.
Recent returnsNothing yet. Start with the blue line.
Change line 2: which index should .at() read?

Changing the index starts a fresh replay. Predict the return value before stepping.

A guided replay recorded from real JavaScript calls, not an engine debugger. Step follows executed statements; Back reviews a snapshot. Reset starts a fresh run.

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?

SORTER

Each resource is reliable for a different kind of question. Sort these everyday developer questions by the place you would check first.

MDN, spec, or compatibility data?
  • 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 structuredClone without 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?
Try it yourself
0 of 6 correct

Pick the best first stop. The explanations tell you why another source might come second.

Choose a category for every card. You can change an answer at any time; Reset clears them all.

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.

Common reference sections and when to read them
SectionBest forBeginner habit
SyntaxThe shape of the callCopy the shape, not the example blindly
ParametersWhat each input meansCheck optional inputs and defaults
Return valueWhat comes backRead this before chaining another method
DescriptionEdge cases and mutationLook for words like changes, returns, shallow, or throws
ExamplesA quick mental modelRun a tiny version in your console
SpecificationsOfficial exact behaviorUse when edge cases matter
Browser compatibilitySupport by versionCheck 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.

Fun fact

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 EXERCISES
Exercise 1 · Warm-upFind the return value

In the modeled reference entry above, what does .at() return when the requested position is outside the array?

Answer, then press Check. Spacing and letter case don’t matter.

    Exercise 2 · PracticePredict .at() results

    Without running it, predict the two console outputs.

    Starter codePop out in the code editor (opens in a new tab)JavaScript
    console.log([10, 20, 30].at(-1));
    console.log([10, 20, 30].at(5));

    Answer, then press Check. Spacing and letter case don’t matter.

      Exercise 3 · PracticeRead an optional-parameter syntax line

      In padStart(targetLength) / padStart(targetLength, padString), which parameter is optional?

      Starter codePop out in the code editor (opens in a new tab)JavaScript
      console.log("7".padStart(3));
      console.log("7".padStart(3, "0"));

      Answer, then press Check. Spacing and letter case don’t matter.

        Exercise 4 · ChallengeCheck a real feature’s compatibility

        Pick any newer feature, such as Array.prototype.toSorted or Object.groupBy. Where should you look to decide whether older browsers need a fallback?

        Answer, then press Check. Spacing and letter case don’t matter.

          Exercise 5 · ChallengeFind the bug: assuming a value exists

          This code reads past the end of the array. What value should it handle before using item?

          Starter codePop out in the code editor (opens in a new tab)JavaScript
          const item = ["first", "second"].at(2);
          console.log(item);

          Answer, then press Check. Spacing and letter case don’t matter.

            Quiz: check your understanding

            7 QUESTIONS

            Your score counts first tries. Read every explanation; wrong choices are designed to teach the boundary between MDN, the spec, and compatibility data.

            Lesson quiz · 7 questionsScore: first tries count
            1. 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.

            2. Question 2 of 7What does this print?

              Read the code, then predictPop out in the code editor (opens in a new tab)JavaScript
              console.log([10, 20, 30].at(-1));

              Choose an answer to see the explanation.

            3. 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.

            4. Question 4 of 7What does this fractional-index call print?

              Read the code, then predictPop out in the code editor (opens in a new tab)JavaScript
              console.log([10, 20, 30].at(1.7));

              Choose an answer to see the explanation.

            5. Question 5 of 7What is Baseline Newly available meant to tell you?

              Choose an answer to see the explanation.

            6. Question 6 of 7Which source would you use to answer: can Safari 15 use structuredClone?

              Choose an answer to see the explanation.

            7. 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.

            CompleteFrontend Clear concepts. Working examples.