Can I disable ECMAscript strict mode for specific functions?

后端 未结 3 1738
轻奢々
轻奢々 2020-11-30 00:21

I don\'t find anything about my question here on MDC or the ECMAscript specifications. Probably somebody knows a more \'hacky\' way to solve this.

I\'m calling

3条回答
  •  星月不相逢
    2020-11-30 01:00

    An alternative is simply doing this

    var stack;
    if (console && console.trace) {
         stack = console.trace();
    } else {
        try {
            var fail = 1 / 0;
        } catch (e) {
            if (e.stack) {
                stack = e.stack;
            } else if (e.stacktrace) {
                stack = e.stacktrace;
            }
        }
    }
    // have fun implementing normalize.
    return normalize(stack);
    

提交回复
热议问题