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

댓글 없음:

댓글 쓰기