Use Strict: How to check it?
I've read people recommending using the "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 the following segemnt code. IE 10 / FF did not issue an error message. What am I missing? How do I check that "use strict" actually works if I'm wrong?
<html>
<head>
<script type = "text/javascript">
"use strict";
function doSomething(value1, value1, value3) {
alert('hello');
}
</script>
</head>
<body>
hello
</body>
</html>
+3
NoobDeveloper
source
to share
2 answers
In this example, you can see that Chrome is actually complaining about the duplicate argument name:
http://jsfiddle.net/vANfY/
+2
Ates goral
source
to share
firefox throws 'duplicate formal value value1',
IE10 throws 'Duplicate formal parameter names are not allowed in strict mode'
0
kennebec
source
to share