找出缓存Symbol里的bug

来自Symbol
Node 24 入门 4分钟 找出1处问题

找出readCache为什么始终读不到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));
在试验场中打开
报告错误