Javascript・jQuery:内容表示
phpだとvar_dumpで変数をチェックできましたが、
jQueryとかだとどうなんだろうなと思って調べたのでメモ。
toSource ・書式 関数orオブジェクト.toSource() ・サンプル var array = new Array("red", "green", "blue"); str = array.toSource(); //["red", "green", "blue"] ・指定した関数や配列、オブジェクトの内容を表示する。
typeof ・書式 typeof(var) ・サンプル typeof(123) //number typeof("ABC") //string typeof("encodeURI") //function typeof(true) //boolean typeof(document) //object typeof(aaaaa) //undefined ・指定した値が何であるかを文字列で返す。
toSource()はだいぶ便利でした。今までいちいちalert出してた。。