但是在高版本的node中不使用"use strict"也直接报错了
- User
但是在高版本的node中不使用"use strict"也直接报错了
Assistant
你观察得非常准确!在高版本的 Node.js 中,即使没有在代码顶部或函数内部明确写
"use strict",直接调用函数(不通过new或作为对象方法调用)时,this的行为也越来越趋向于严格模式,即this会是undefined,而不是指向全局对象 (global或globalThis)。
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.