返回或設(shè)置與特定錯(cuò)誤相聯(lián)系的描述字符串。
object.description [= stringExpression]
description 屬性包含與特定錯(cuò)誤相聯(lián)系的錯(cuò)誤信息字符串。使用包含在這個(gè)屬性中的值,來(lái)警告用戶發(fā)生了一個(gè)不能或不想處理的錯(cuò)誤。
下面的例子舉例說(shuō)明了 description 屬性的使用:
try
x = y // 產(chǎn)生錯(cuò)誤。
catch(var e){ // 創(chuàng)建局部變量 e。
document.write(e) // 打印 "[object Error]"。
document.write((e.number & 0xFFFF)) // 打印 5009。
document.write(e.description
) //打印 "'y' is undefined"。
}
number 屬性 | message屬性 | name屬性
應(yīng)用于:Error 對(duì)象