这段代码的 es5 等价物是什么

what is the es5 equivalent of this code

function handleDeposit (accountNumber, amount) {
  type: 'DEPOSIT',
  accountNumber,
  amount
}

它 returns 调用时未定义。我不确定这里使用的是 es6 的什么特性

是否等同于...

function handleDeposit (accountNumber, amount) {
  return {
    type: 'DEPOSIT',
    accountNumber: accountNumber,
    amount: amount
  }
}   

对于给定的 ES5 结果,您需要使用 short hand properties 作为 ES6 示例将属性包装在对象结构中。

function handleDeposit (accountNumber, amount) {
    return {
        type: 'DEPOSIT',
        accountNumber,
        amount
    };
}

您给定的代码

function handleDeposit (accountNumber, amount) {
     type: 'DEPOSIT',
     accountNumber,
     amount
}

内部没有对象,但有一个标签 type,一些逗号运算符,并且没有以 return 结尾,也没有任何值。

您使用 undefined.

获得函数的标准 return 值

I'm not sure what feature of es6 is being used here

None。使用 es2017 预设通过 Babel 传递函数只会导致重新格式化代码。

这只是一个包含 label, followed by a string literal, then two arguments, each separated by comma operators 的函数(有两个参数)。

没有return声明。

该函数什么都不做,return什么都不做,是 ES5。