레이블이 javscript block scope falsy value error handling인 게시물을 표시합니다. 모든 게시물 표시
레이블이 javscript block scope falsy value error handling인 게시물을 표시합니다. 모든 게시물 표시

2015년 8월 30일 일요일

Javascript Block Scope, Falsy Value, Error Handling

Let's see javascript block scope( {...}), False values and throw, Error Handling statements. Learning test is written using Jasmine. Please refer Jasmine usage which I wrote before if you have interest it.

1. Javascript don't have Block Scope before ECMAScript6



2. Falsy value

false, undefined, 0, empty string(""), NaN are treated as a false.

3. Throw expression, try - catch - finally

Javascript can throw any expression using "throw" keyword. The throwed expression can be used in catch statement like [line 15], [line 43]. You can see how to use try - catch -finally statements.

4. Error Object

You can throw Error Object easily.

5. Reference

- MDN - https://developer.mozilla.org/en/docs/Web/JavaScript
- Jasmine - http://jasmine.github.io/2.3/introduction.html