script oldError Error Error function let e new oldError this stack e stack split n this stack this stack slice 0 2 this stack splice 1 1 this stack this stack join n script script var caller line new Error stack console log caller line let a 2 var b 23 let g 2 var b 2 b 2 b 2 function valid var caller line new Error stack stack split n 4 console log caller line valid script
line new Error stack console log caller line let a 2 var b 23 let g 2 var b 2 b 2 b 2 function valid var caller line new Error stack stack split n 4 console log caller line valid script