NoobDeveloper
NoobDeveloper

Reputation: 1887

Use Strict : How to test it?

I have been reading people recommending using "use strict" option. As mentioned here

every major browser supports strict mode in their latest version, including Internet Explorer 10 and Opera 12. I wanted to test it with IE10 and i have following code segemnt. IE 10 /FF did not gave any error message. What am i missing ? How do i test that "use strict" is actually working if i make any mistake ?

<html>
<head>
<script type = "text/javascript">
"use strict";
function doSomething(value1, value1, value3) {
     alert('hello');
}
</script>
</head>
<body>
hello
</body>
</html>

Upvotes: 3

Views: 954

Answers (2)

kennebec
kennebec

Reputation: 104780

firefox throws 'duplicate formal argument value1',

IE10 throws 'Duplicate formal parameter names not allowed in strict mode'

Upvotes: 0

Ateş G&#246;ral
Ateş G&#246;ral

Reputation: 140060

You can see in this example that Chrome actually complains about the duplicate argument name:

http://jsfiddle.net/vANfY/

Upvotes: 2

Related Questions