作者rkt (不能实现的梦)
看板Ajax
标题[ js ] try catch let的问题
时间Tue Jul 1 21:23:48 2008
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)
1F:推 fillano:你用的直译器或引擎??我用js1.8跑不出来你的结果 07/02 01:25
2F:→ rkt:用js1.8可以跑出 x.t has no property的结果吗 07/02 08:54
3F:→ rkt:我也是用1.8在跑的 07/02 08:57