小编Jas*_*son的帖子

节点中的箭头函数提升?

我在理解为什么我的代码有效时遇到了一些麻烦。我期待参考错误,但一切正常。

我的代码:

const functionA = () => {
  let bResult = functionB();

  console.log("Function A " + bResult);
};

const functionB = () => {
  return "Function B";
};

functionA();
Run Code Online (Sandbox Code Playgroud)

我得到这个输出(没有错误);

? node test.js
Function A Function B
Run Code Online (Sandbox Code Playgroud)

据我了解,只有函数声明被提升(不是函数表达式)http://adripofjavascript.com/blog/drips/variable-and-function-hoisting.html

因此,我不应该期待一个错误,因为在 FunctionA 中调用它之前没有定义 FunctionB 吗?我在这里失踪了吗?

编辑:感谢大家的回答,我想我想通了。它确实没有被提升,因为如果我在开始时调用 functionA,它会给我一个错误。

functionA(); // ReferenceError: functionA is not defined

const functionA = () => {
  let bResult = functionB();

  console.log("Function A " + bResult);
};

const functionB = () => {
  return "Function B";
}; …
Run Code Online (Sandbox Code Playgroud)

javascript function node.js hoisting arrow-functions

6
推荐指数
1
解决办法
2993
查看次数

Azure 管道 - 使用 Azure 源进行 npm 安装错误 403

我的 NPM 安装步骤配置为使用 .npmrc 中的注册表,

配置 我的 .npmrc 如下

registry=https://pkgs.dev.azure.com/xxx/xxxx-xxxx-xxxx/_packaging/design-system/npm/registry/

always-auth=true
Run Code Online (Sandbox Code Playgroud)

Azure Artifacts 源已设置,npm install我的开发机器上的本地工作完全正常。 天蓝色的文物

然而,管道的npm install工作总是以错误 403 失败。

在管道中安装 npm

我在这里做错了什么?我还尝试将 npm install 任务更改为使用我在此处选择的注册表,并将其直接链接到我的“设计系统”提要,但会导致相同的错误。我已经按照https://docs.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows 的所有步骤操作,但它不起作用。谢谢

installation azure node.js npm azure-artifacts

6
推荐指数
1
解决办法
1629
查看次数