benchmark.js icon indicating copy to clipboard operation
benchmark.js copied to clipboard

Strict mode

Open Joris-van-der-Wel opened this issue 9 years ago • 3 comments

I would like to use strict mode in my benchmark functions. (E.g. so that I can use let).

The "use strict"; statement must be the first statement of a function. I can not activate strict mode because of the compilation performed by this library (unless I use closures or move everything to an external function).

Would it be a good idea to add a Benchmark option for strict mode?

Joris-van-der-Wel avatar Jun 11 '15 23:06 Joris-van-der-Wel

You could aways test functions that are in strict mode.

jdalton avatar Jun 11 '15 23:06 jdalton

Yes, that is already happening ;).

My intention is to be consistent with the rest of the code base. (strict mode everywhere, no more var, etc). Not a high priority feature, but it would be nice to have (I'm willing to whip up a PR).

Joris-van-der-Wel avatar Jun 11 '15 23:06 Joris-van-der-Wel

I can dig it. PR's away!

jdalton avatar Jun 11 '15 23:06 jdalton