这个版本选择器会输出什么?

来自 API 版本管理
Node 24 入门 2分钟

这个版本选择器会输出什么?

JavaScript
function resolve(path) {
  const match = /^\/api\/(v1|v2)\//.exec(path);
  return match ? match[1] : "unsupported";
}

console.log(resolve("/api/v2/orders"));
console.log(resolve("/api/v3/orders"));
在试验场中打开
报告错误