以下のJavaScriptを使用して、JSfiddleエディタを使用してSafariで行番号のエラーをログに記録できましたが、ChromeまたはFirefoxではエラーを記録できませんでした。私はFirebugプラグインを使ってFirefoxで行番号のエラーを得ることができるとわかりましたが、私はFirebug Liteを外部リソースとしてJSfiddleを使ってChromeで同じことをしたいと考えています。JSfiddleの行番号を取得する方法
//I pasted all of this into the JAVASCRIPT portion of jsfiddle editor
//I then pasted the FireBug Lite URL in the External Resources (left menu in jsfiddle) :
//https://getfirebug.com/firebug-lite-debug.js
//then hit enter
try {
console.log('hello world');
//console.log(x); //x was never defined
console.log(x); //x was never defined
} catch (error) {
console.log(error);
//is there a way to include line 8 with the RererenceError?
//I tried Safari and get this output: ReferenceError: Can't find variable: x {line=55, ...}
var errorLineNumber = Number(error.line) - 48;
console.log('Line number of the error is: ' + errorLineNumber) //works in safari to log: Line number of the error is: 8
//In Chrome and Firefox, it logs: Line number of the error is: NaN
} //then clicked Run in JSfiddle
助けてください。
なぜ通常のchrome開発ツールを使用していませんか?私はかなり彼らがFirebug Liteよりも優れていると確信しています。 – vlaz