In js debugging, when the output content is an object and cannot be printed, alert can only print the object identifier, but cannot print the content. This is inconvenient, as a result, we have summarized the following code:
Function writeObj (obj) {var description = ""; for (var I in obj) {var property = obj [I]; description + = I + "=" + property + "\ n";} alert (description );}
In addition, when you need to convert an object to a string, you can refer to: js to convert an Object to a String function code.
Articles you may be interested in
- Js print array, js Print Object Method
- JavaScript to print pages
- Javascript to get the current mouse position (compatible with IE and firefox)
- Js restrictions: Only English letters and numbers can be entered. Chinese characters and other special characters cannot be entered.
- Thinkphp prints the last SQL statement
- Invincible firewheel effect in the address bar of JavaScript Browser
- Use JavaScript to verify the regular expression of the mobile phone number
- How to obtain the complete url address and parameters in javascript