[ js ] try catch let的問題
var actual='';
try
{
try { throw 1; }
catch(e4 if 0) {print("catch e4"); }
catch(e5 if (new NaN)) {print("catcah e5"); }
}
catch(ex)
{
print("catch ex");
actual = ex + '';
}
print(actual);
try
{
z = [1];
let ( x = (undefined ? 3 : z)) { x.t.g }
}
catch(ex)
{
actual = ex + '';
}
print(actual+" 2");
------------------------------
第二次print的結果卻是
e4.t has no property
本來是希望跑出 x.t has no property
想不通為什麼會這樣
變成第一個catch裡面的e4
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.17.165
※ 編輯: rkt 來自: 218.167.17.165 (07/01 22:08)
推
07/02 01:25, , 1F
07/02 01:25, 1F
→
07/02 08:54, , 2F
07/02 08:54, 2F
→
07/02 08:57, , 3F
07/02 08:57, 3F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
40
171