When making an implementation of console.count([label]) part of the Mozilla's developer docs https://developer.mozilla.org/en-US/docs/Web/API/Console/count mentions when label is omitted, the function will count the number of times count() was called on that line... however, if the javascript code has been minified all lines of code may be on the same line... messing up all console.count() calls...
I was providing that implementation by using new Error().stack and parsing the current file:line... however I could fix the minify issue if new Error().stack output the column also for instance... other browser seem to be doing file:line:column in the stack trace. Including nodejs see: https://nodejs.org/api/errors.html#errors_error_stack Microsoft Edge's dev console outputs... new Error().stack: "Error at eval code (eval code:1:1)" Firefox since FF30: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack Currently nashorn error stacks only include the line number... public static void main(String[] args) throws Exception { NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); ScriptEngine scriptEngine = factory.getScriptEngine(); scriptEngine.put(ScriptEngine.FILENAME, "myfile.js"); scriptEngine.eval("print('fileName: ' + new Error().fileName);"); scriptEngine.eval("print('lineNumber: ' + new Error().lineNumber);"); scriptEngine.eval("print('columnNumber: ' + new Error().columnNumber);"); scriptEngine.eval("print('stack: ' + new Error().stack);"); } /* fileName: myfile.js lineNumber: 1 columnNumber: -1 stack: Error at <program> (myfile.js:1) */ Would be nice to add the column number to the stacks and error object in nashorn. Thanks, Arthur Fiedler