try ~ catch

2007年1月27日
1 分

例外処理。

try {
    var today = Date();
    today.set_month(3);      // no such method.
} catch (e) {
    document.write(e);       // => [object Error]
}

例外を発生させるには throw かな。