📜  在 javascript 代码示例中设置

📅  最后修改于: 2022-03-11 15:03:28.988000             🧑  作者: Mango

代码示例6
const language = {
  set current(name) {
    this.log.push(name);
  },
  log: []
};

language.current = 'EN';
language.current = 'FA';

console.log(language.log);
// expected output: Array ["EN", "FA"]