如何挂钩每个新 String 实例的创建?
How to hook every creation of a new String instance?
是否可以挂钩每个新的 String
的创建?每次这样的代码都是 运行:
const new_string = 'Hello World!';
我想收到通知;例如;
console.log('A new String was created:', whatever_new_string_was_created);
字符串是没有关联事件的基元,构造函数无法更改它的方法:https://tc39.es/ecma262/#sec-string-objects
是否可以挂钩每个新的 String
的创建?每次这样的代码都是 运行:
const new_string = 'Hello World!';
我想收到通知;例如;
console.log('A new String was created:', whatever_new_string_was_created);
字符串是没有关联事件的基元,构造函数无法更改它的方法:https://tc39.es/ecma262/#sec-string-objects