JavaScript has many pitfalls. In strict mode you can detect some bugs earlier. Strict mode makes several changes to normal JavaScript semantics:
When you start a new application, you can switch on strict mode from the beginning.
For more information about strict mode see:
You should, however, be careful when using strict mode in applications with an existing codebase. Since some of the errors are only detected during runtime, switching to strict mode for your existing productive code without testing everything can be risky. If you cannot ensure all code is touched by automated tests, you might not want to enable strict mode for your productive code. Instead you can use the strict mode for executing your unit tests to detect some bugs earlier without putting strict mode in the productive implementation.
How to? You can use a self-executing anonymous function to put your test in strict mode. Douglas Crockford describes the reasons for using the self-executing function in his blog post: http://www.yuiblog.com/blog/2010/12/14/strict-mode-is-coming-to-town/
( function() {
"use strict";
module( "Assign List", {
setup : function() {
},
});
test(){
}
..
}());
This blog post is part of a series, like the following blog post to stay tuned and get updates about more topics around software engineering with SAPUI5 and JavaScript:
http://scn.sap.com/community/developer-center/front-end/blog/2013/12/12/engineering-in-javascript
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
10 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
4 |