如何在JavaScript中命名数组对象的映射? [关闭]

我有一个像这样的对象,它是任务名称到数组的映射:

const object = {
  tasks1: ['task-1',  'task-2',  'task-3'],
  tasks2: ['task-1',  'task-2',  'task-3'],
}

如何根据JavaScript约定命名?

评论
  • modit
    modit 回复
    const tasksMap = {
      tasks1: ['task-1', 'task-2', 'task-3'],
      tasks2: ['task-1', 'task-2', 'task-3'],
    }
    

    Name it tasksMap because it maps tasks from their name to their reference.