Property stack ของ Error objects ให้ trace ว่าฟังก์ชันไหนถูกเรียก ลำดับไหน จากบรรทัดไหน ไฟล์ไหน และ arguments อะไร Stack string เริ่มจาก recent calls ไป earlier ones ย้อนกลับไป original global scope call คล้าย stack trace ใน Java
ตัวอย่าง
function a() { throw new Error("error"); } try{ a() } catch(e) { console.log(e.stack) }ผลลัพธ์
จะได้ output
Error: error at a (<anonymous>:2:11) at <anonymous>:6:5
หมายเหตุ - Stack เป็น non-standard property อาจไม่มีในบาง environments