Does JavaScript have a mechanism for determining the line number of the currently executing statement (and if so, what is it)?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
var thisline = new Error().lineNumber
If that doesn't work in whatever environment you're using, you can try:
var stack = new Error().stack
Then hunt through the stack for the line number.