跳到正文
DEV Community· Jeremiah Say·· 52 分鐘前AI 評分21

Fender JavaScript 序號查詢:為何 E412345 可代表美國或日本製造

Fender serial number lookup in JavaScript: why E412345 can mean the USA or Japan

AI 導讀

作者為 Who Actually Makes 建立 Fender JavaScript 序號查詢工具,讓 E412345 顯示美國和日本兩種可能讀法,而非只回傳首個匹配結果。工具收錄 162 條規則,並以 64 項測試核對解碼結果;序號本身無法判定產地,還要查看琴身標籤上的產地字樣。

正文

Type E412345 into a Fender serial decoder. When and where was the guitar made?

According to Fender's own dating charts, it's one of two guitars:

  • USA, 1984 to 1988. "E4 + 5 digits" is a row on the American chart.
  • Japan, 1984 to 1987. "E + 6 digits" is a row on the Japanese chart.

Both patterns match the same seven characters. The serial alone can't decide. What decides is printed right next to it: the decal that says Made in USA or Made in Japan.

I built a Fender serial number lookup for Who Actually Makes. Every rule in it comes from Fender's support articles, and the build checks every rule against a saved copy of those articles. This post covers how it's built: rules as data, a decoder that returns every reading instead of the first, and tests that run Fender's charts back through the code.

Fender already has a lookup. Why build one?

Fender runs an official lookup, and it's the first place to try. But its own notice says that "not all serial numbers are included in the lookup function". Older and odder serials come back with nothing.

Fender also publishes the rules behind its serials, as support articles split by country: USA, Mexico, Japan, Korea, Indonesia, and the odd ones. They're charts a person reads, not data a program can use. So the job was to turn those charts into data without changing what they say.

Rules as data, each tied to its chart row

Each rule is a JSON object: a regex, a country, how to get the years, and the chart row it came from, word for word:

{
  "id": "jp-e6",
  "re": "^E[0-9]{6}$",
  "c": "JP",
  "y": { "t": "fixed", "a": 1984, "b": 1987 },
  "row": "E + 6 digits",
  "ev": "ev-fender-jp-records",
  "tier": "chart",
  "decal": ["japan-made"]
}

There are 162 of them: 139 from Fender's charts, 22 from its list of odd serials, and 1 general pattern. The row field matters most. The build looks up the evidence record (ev), loads the saved copy of that Fender article, and stops if the row's words aren't in it:

if norm(r["row"]) not in archived(r["ev"]):
    raise SystemExit(f"fender-serial: rule {r['id']}: row {r['row']!r} not in {r['ev']}'s saved copy")

So a rule can't drift away from its source. If I mistype "E + 6 digits" as "E + 5 digits", the build fails. If Fender rewrites the article, the next re-read (booked every 90 days) shows exactly which rows changed.

Year formats are a small language

The years come out in five different ways, so y.t names the format:

function yearsOf(r, m, now) {
  const y = r.y;
  switch (y.t) {
    case 'fixed': return [y.a, y.b || now.y];            // "E4": 1984-1988
    case 'dec':   return [y.base + +m[1], y.base + +m[1] + y.span];  // "SE8" = 1988
    case 'yy': {                                          // "MX18": 2018
      const v = +m[y.g || 1];
      let a = 2000 + v;
      if (a > now.y + 1) a = 1900 + v;                    // "KC97" = 1997, not 2097
      if (a < y.from || a > now.y + 1) return null;
      return [a, Math.min(a + y.span, now.y)];
    }
    // 'num' (a numeric range) and 'krnum' (Korea's digit-only years) omitted
  }
}

Most results are two-year windows, and that's deliberate. Fender's Mexico article explains why: "necks that are made and serial numbered late in any given year are used on instruments assembled in the early months of the following year." MX18012345 is 2018 to 2019, not 2018.

Return every reading, not the first match

The obvious decoder loops over the rules and returns the first match. That's wrong for Fender, because some prefixes really are ambiguous. Three of them:

Serial Readings without the decal
E412345 USA 1984–1988, or Japan 1984–1987
S912345 USA 1978–1981, Japan 1994–1995, or Japan 2006–2008 ("Crafted in Japan")
V123456 USA Vintage series 1982–2017, or Japan 1996–1997

So decode() collects every rule that matches, merges readings that say the same thing, and only then uses the decal to split them into "fits" and "other":

const r = decode('S912345', '', data, now);
r.state;   // 'many': three readings, ask about the decal
decode('S912345', 'usa', data, now).state;   // 'one': USA, 1978-1981

When no decal is chosen, the page shows all the readings and asks one question: what does the decal say? An earlier draft set the decal to "Made in Mexico" by default because that's the most common answer. It produced false "doesn't match" warnings for American and Japanese guitars, so the default is now "Not sure".

Small kindnesses for typed input

Serials get typed from a photo of a headstock, so the decoder forgives the usual slips:

function norm(raw) {   // "mx 18-012345" -> "MX18012345"
  return String(raw || '').toUpperCase().replace(/[\s\-.\/]+/g, '');
}

And if nothing matches, it retries with the letter O read as a zero in the digits, so MZO123456 becomes MZ0123456 (Mexico, 2000 to 2001). The result says it made that change, so nobody is misled.

Chart, list, rule, pattern: say how sure you are

Not every reading is equally solid, so each carries a tier:

  • chart: a row Fender prints in its dating chart.
  • list: from Fender's list of odd and non-standard serials.
  • rule: past the last row Fender prints, but Fender states the rule. Its MX chart stops at 2017, while its text says the first two digits are the year. So MX18… is Fender's rule, not Fender's chart.
  • pattern: a general layout that isn't Fender's, used only when nothing else matches.

The tier is shown on every result, so the page never claims more than Fender does.

Tests: Fender's charts, run backwards

tools/test_fender_serial.mjs holds 64 checks. Most are Fender's own chart rows turned into serials, with the expected country, years and tier:

const T = [
  ['MN8123456', 'mexico', 'MX', 1998, 1999, 'chart'],
  ['MX18012345', 'mexico', 'MX', 2018, 2019, 'rule'],
  ['E412345', 'japan-made', 'JP', 1984, 1987, 'chart'],
  ['E312345', 'usa', 'US', 1982, 1985, 'chart'],
  ['MZO123456', '', 'MX', 2000, 2001, 'chart'],   // O typed for 0
  // ...
];

Plus the ambiguous cases: E412345 with no decal must return both the US and the Japanese reading. If a refactor makes the decoder stop at the first match, that test fails. The build runs these and stops on any failure.

What a serial can't tell you

Fender is blunt about the limits, and the page repeats them:

  • Not exact. US serials overlap "two to four years from the early days of Fender to the mid-1980s", in Fender's words. The neck date is often a better guide.
  • Not authenticity. Fender says a serial missing from its lookup "is not indicative of any lack of authenticity". A real-looking serial doesn't prove a guitar is genuine either.
  • Not value. Fender doesn't comment on what used instruments are worth, and neither do we.

Try it

The Fender serial number lookup takes a serial and a decal and gives the country, the years and, where Fender names it, the factory. Each result names the chart row and links to the Fender article it came from. For vintage instruments it also decodes potentiometer date codes, which date the electronics. For amplifiers, there's a separate Fender amp serial lookup.

AI assistants helped read the sources and draft this post, as they do on the site. The examples were run on 20 November 2026, against Fender's articles as saved in November 2026.

來源:DEV Community · dev.to