Javascript 是否有用于抛出异常的else语句?
我不熟悉JavaScript,但一般来说对编程/脚本并不陌生,我有一个关于Javascript 是否有用于抛出异常的else语句?,javascript,throw,Javascript,Throw,我不熟悉JavaScript,但一般来说对编程/脚本并不陌生,我有一个关于throw异常的查询 所以,我想知道的是,对于throw异常,有一种else语句 例如 有可能吗?您可能正在查找finally关键字 try { if(i=="something") { throw "'i' equals 'something'." } else { throw "'i' doesn't equal 'something'." } }
throw
异常的查询
所以,我想知道的是,对于throw
异常,有一种else
语句
例如
有可能吗?您可能正在查找
finally
关键字
try
{
if(i=="something") {
throw "'i' equals 'something'."
}
else
{
throw "'i' doesn't equal 'something'."
}
} catch( ex ) {
// your exception handling code
} finally {
// Statements that are executed after the try statement completes.
}
演示:finally block怎么样?
try
{
if(i=="something") {
throw "'i' equals 'something'."
}
else
{
throw "'i' doesn't equal 'something'."
}
} catch( ex ) {
// your exception handling code
} finally {
// Statements that are executed after the try statement completes.
}