A friendly. Improved implementation of object. Prototype. tostring
Source: Internet
Author: User
Almost every object in Javascript has a tostring () method, which is built-in and used to output the current
Variable information. But for the most common object objects, Every time tostring is used, [object] is printed.
{A: 1, B: 2, C: 3}. tostring () ==> [object]
This is depressing, so I have implemented a friendly function that prints all the members of the object,
Nested output is supported, and array content can be printed in a friendly way.
Post it here CodeWe hope to learn and improve this function together.
Use Vim to write an out-of-the-box question. ProgramIt's not so refreshing.
My ability to express myself is limited. I can only express my love for VIM with "no help ".
Http://www.vim.org/
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service