console.log等でobjectを出力するとコンソールには出力した時点のobjectではなく一連の処理が終わった後のobjectがでるのでちゃんと確認するならconsole.debug(obj.toSource())する。JSON.stringifyもあり#JSdebug
console.log等でobjectを出力するとコンソールには出力した時点のobjectではなく一連の処理が終わった後のobjectがでるのでちゃんと確認するならconsole.debug(obj.toSource())する。JSON.stringifyもあり#JSdebug
どこかで元ネタを見たんやけど、忘れた・・・ console.logとかdebugって開発してるとき便利ですけど、納品時に消すのを忘れたりして、うっかりconsoleに unko とか表示されたら死ぬしかないですよね。 消したやつ納品して後で改修とかになったとき、前のconsoleは当然ないわけで、面倒くさいなと思って。 下記のコードをソースファイルの頭に貼り付けておいて 頭の「window.console.debugMode」を「true」にすればconsole.logが動きます。それだけです。これなら、元のコードも変更せず、debugModeを切り替えるだけで楽々デバッグ。 // デバグモードの切り替え window.console.debugMode = false; // console.logのプチ整形 window.console._log = window.console.lo
Benchmark.js v2.1.2 A benchmarking library that supports high-resolution timers & returns statistically significant results. var suite = new Benchmark.Suite; // add tests suite.add('RegExp#test', function() { /o/.test('Hello World!'); }) .add('String#indexOf', function() { 'Hello World!'.indexOf('o') > -1; }) .add('String#match', function() { !!'Hello World!'.match(/o/); }) // add listeners .on('c
Web Workers are threads for client-side JavaScript. There are a lot of very cool things about them, but one of the not-so-cool things about them is that it is hard to debug code running in a worker thread. Worker's don't have access to the DOM. They can't call alert(), they can't modify the document and they don't have the console.log() API that we've all come to depend on. I've put together a pro
PHPの開発者であれば皆使うのがvar_dumpだ。開発中はもちろんデバッグ時などに非常に重宝する。エラーがあっても出力してくれるので、これがなければ生活できないという人も多いのではないだろうか。 JavaScriptでも変数のダンプを メソッドを調べる必要もなく、知りたいものを関数に入れれば全ての情報を出してくれる。そんなvar_dumpの魅力をJavaScriptでも再現したのがprettyPrint.jsだ。 今回紹介するフリーウェアはprettyPrint.js、JavaScriptの変数ダンプライブラリだ。ソースコードは公開されているが、ライセンスは明記されていなかったのでご注意いただきたい。 prettyPrint.jsはJavaScriptのオブジェクトを指定すれば、その中身をダンプし、テーブル組で見やすく表示してくれるライブラリだ。PHPのvar_dumpよりも、cfdum
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く