我在理解为什么我的代码有效时遇到了一些麻烦。我期待参考错误,但一切正常。
我的代码:
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) 我的 NPM 安装步骤配置为使用 .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 install 任务更改为使用我在此处选择的注册表,并将其直接链接到我的“设计系统”提要,但会导致相同的错误。我已经按照https://docs.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows 的所有步骤操作,但它不起作用。谢谢