在 VSCode 中的 node.js 项目中,我尝试在运行规范之前读取配置信息。但我的规范总是在“beforeAll”块之前首先执行。
\n\nbeforeAll(() => {\n console.log(\'Step0\xe2\x80\xa6\xe2\x80\xa6\xe2\x80\xa6..: \');\n return new Promise(resolve => {\n console.log(\'Step1\xe2\x80\xa6\xe2\x80\xa6\xe2\x80\xa6..: \');\n\n browser.getProcessedConfig().then((config) => { \n console.log(\'environment 12: \' );\n resolve(true);\n }); \n });\n});\n\ndescribe(\'*************************Executing TestSuite************************\', function () {\n console.log(\'Step2\xe2\x80\xa6\xe2\x80\xa6\xe2\x80\xa6..: \');\n it("should support async execution of test preparation and expectations", function() {\n expect(3).toBeGreaterThan(0);\n }); \n});//describe\nRun Code Online (Sandbox Code Playgroud)\n\n我尝试简化代码以仅保留一个期望语句,但它仍然是相同的。
\n\n我得到的当前输出是 Step 2 、 Step 0 、 Step 1
\n\n我期待的是步骤 0、步骤 1、步骤 2
\n嗨,我想了解JavaScript的基本原理,并陷入一个条件.
var foo = 1;
function bar(){
foo = 10;
return;
function foo(){}
}
bar();
alert(foo);
Run Code Online (Sandbox Code Playgroud)
在这里alert(foo),会给我1,并且我知道在return语句之后,函数foo()将不会执行.但是现在如果改变代码:
var foo = 1;
function bar(){
foo = 10;
return;
}
bar();
alert(foo);
Run Code Online (Sandbox Code Playgroud)
在条形函数中,如果我将删除函数foo().然后alert(foo)会给我10
请帮忙,如果有人能解释我为什么?