● Strict mode 사용법
- js 파일 혹은 function 에 명시
- js 파일 혹은 function 에 명시
js 파일 사용예)
//test.js "use strict"; var v = "test variable";
function 사용예)
 
//test.js
function test(){
    "use strict";
    var result = "test variable";
    return result;
}
 v = test(); // test()내부에 Strict mode를 선언, 오류 발생하지 않음
console.log( v );
 
function 사용예)
//test.js
"use strict";
function test(){
    result = "test variable"; //js파일 상단에 Strict mode를 선언, 오류 발생
    return result;
}
var v = test();
console.log( v );
참고
- http://ejohn.org/blog/ecmascript-5-str ··· and-more
 - http://kangax.github.io/es5-compat-table/strict-mode/
 
"JavaScript / Node.JS" 분류의 다른 글
| [node.js] ajax로 타 도메인과 연동 문제 / CORS(Cross-Origin Resource Sharing) (0) | 2013/12/20 | 
| [node.js] cluster를 이용한 멀티코어(multi-core) 사용 (0) | 2013/10/22 | 
| [node.js] traceback (0) | 2013/10/22 | 
| [node.js] log4js PatternLayout 사용하기 (0) | 2013/10/21 |