JavaScript(2)
-
Javascript the good parts(자바스크립트 핵심 가이드)
Javascript the good parts(자바스크립트 핵심 가이드) Javascript the good parts을 읽으며 메모한 내용들을 기록해 봅니다. NaN NaN은 수치 연산을 해서 정상적인 값을 얻지 못할 때 반환되는 값입니다. isNaN() 함수를 통해서 NaN인지 비교할 수 있습니다. function isNumber(value) { if (isNaN(value)) { console.log(value + ' is not number.'); } else { console.log(value + ' is number.'); } } isNumber(123); isNumber("abc"); >> 123 is number. >> abc is not number. var ..
2020.07.05 -
Maintainable Javascript
Maintainable Javascript 'Maintainable Javascript'을 읽으면서 메모한 몇 가지 내용들을 정리해 본다. Warning strict Mode는 전역으로 선언하지 않는다. strict 모드는 함수 안에서만 사용해야 하며 절대로 전역으로 사용하지 않아야 한다. (function() { "use strict" function doSomething() { } function doSomethingElse() { } eval()은 절대 사용하지 않는다. with 문은 절대 사용하지 않는다. 이 문장은 strict 모드에서 사용할 수 없을 뿐만 아니라 앞으로 나올 ECMAScript에서 사용할 수 없게 될 수도 있다. const ECMAScript6에 상수 선언 추가됨..
2020.07.04