Spot the bug in the cache Symbol

from Symbol
Node 24 beginner 4 min 1 issue to find

Find why readCache never retrieves the value written by writeCache.

JavaScript
const cacheKey = Symbol('cache');

function writeCache(record, value) {
  record[cacheKey] = value;
}

function readCache(record) {
  return record[Symbol('cache')];
}

const order = {};
writeCache(order, 7);
console.log(readCache(order));
Open in playground
Report an error