How to enable javascript strict mode using 'use strict'?

You must Login before you can answer or comment on any questions.

Anybody know how to enable strict mode? in simulator or device.

just adding 'use strict' at the first line of the each file didn't work for me.

ECMA Script5 strict mode

— asked 10 months ago by Jung Wook Son
5 Comments
  • why exactly do you want to do this?

    — commented 10 months ago by Stephen Feather

  • Why not? :D

    — commented 10 months ago by Ivan Škugor

  • I ask because most javascript "programmers" (read: web monkeys) do not understand the ramifications of using strict mode.

    — commented 10 months ago by Stephen Feather

  • Show 2 more comments

2 Answers

i did not think you could enable it, only get the validator to generate errors/warnings by setting the Validation properties on the project with JSLint

You can use strict mode by just adding "use strict" at the first line on v8, but I don't think it's available on JSC (iOS). Note that you need to specify "use strict" in every CommonJs module because every CommonJs module is new JS context (new and clean JS environment).

Your Answer

Think you can help? Login to answer this question!