Javascript .那么这不是一个函数

Javascript .那么这不是一个函数,javascript,es6-promise,Javascript,Es6 Promise,为什么这一行是有效的承诺: const promise = Promise.resolve('Hello'); 但不是这个: const otherPromise = () => { return Promise.resolve('Hello'); } 尝试调用第二个示例时,使用: function runOtherPromise() { otherPromise .then(v => console.log(v)); } …我得到TypeError:other

为什么这一行是有效的承诺:

const promise = Promise.resolve('Hello');
但不是这个:

const otherPromise = () => {
  return Promise.resolve('Hello');
}
尝试调用第二个示例时,使用:

function runOtherPromise() {
  otherPromise
    .then(v => console.log(v));
}

…我得到
TypeError:otherPromise.then不是一个函数
。不过,对于第一个示例,它工作得很好。我不明白为什么第二个示例不返回承诺。

其他承诺是一个函数,您应该像下面这样调用它:

runOtherPromise() {
    otherPromise()
        .then(v => console.log(v));
}
otherPromise()。然后(v=>console.log(v))将完成此工作!