I searched a lot but could not get correct / updated answer (arguments.caller.callee does not exist it seems). I want to know the code line number where a particular function is called. I got this solution where function caller name can be retrieved .
But I am calling my function in JQuery UI droppable. For eg:
$("#id").droppable({
stop: function(e,u){
main(); // I want this line number
}
});
Thats the reason I wanted to know the line number . Is there any way ?
If you use console.error(), it will show the call stack and the line numbers (at least in Chrome, when you click the small black arrow):
function foo(){
bar();
}
function bar(){
console.error("hello");
}
foo();
Will show:

Check this fiddle (console.error doesn't work properly in the snippet): https://jsfiddle.net/fs1qqe77/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With