• A+

1. 用数组长度截取数组


最初,arr1和arr2都指向了数组[1,2,3],之后当arr1重新指向[ ]的时候,arr2的引用并没有发生什么变化,仍然指向[1,2,3]。但是如果我们想让arr1和arr2都指向[ ]的话,那应该怎么做呢?我们可以利用数组的长度属性。当设置arr1.length=0的时候,arr1里面的要素将被清空。而引用是不会改变的,所以arr1和arr2指向[ ]。
2. 用push来合并数组




3. 特征检测




4. 检查某一个对象是不是数组
在JavaScript编程语言里,我们可以使用typeof来检查变量的类型,typeof可以返回数字、布尔值、字符串、对象、函数和未定义的对象。事实上这里没有数组,typeof数组就是一个对象。所以我们怎么来决定一个对象就是一个数组呢?在ECMAScript 5编程语言里,我们可以使用 Array.isArray(obj)来检查这里所提到的问题。但是目前ECMAScript 5还没有得到广泛使用。




:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

Blue Captcha Image


目前评论数:16   其中:访客评论  0   博主回复  0

    • avatar Niki 0

      I think this is one of the most vital info for me. And i’m glad reading your article.
      But want to remark on few general things,
      The website style is wonderful, the articles is really excellent : D.
      Good job, cheers

        • avatar xylon 2

          @Niki Thank you, thank you very much for your appreciation

        • avatar หนังโป๊ 0

          It is in reality a nice and helpful piece of info.
          I’m satisfied that you just shared this useful info with us.
          Please stay us up to date like this. Thanks for sharing.

          • avatar Franchesca 0

            Hi, i think that i noticed you visited my website thus i
            came to return the desire?.I am trying to to find issues to
            enhance my web site!I suppose its ok to use some of your ideas!!

              • avatar xylon 2

                @Franchesca Yeah, you’re welcome to my blog,Can I help you with something?

              • avatar Florian 0

                I absolutely love your blog and find many of your post’s to be what precisely I’m looking for.

                Do you offer guest writers to write content for yourself? I
                wouldn’t mind creating a post or elaborating on most of the subjects
                you write regarding here. Again, awesome site!

                  • avatar xylon 2

                    @Florian Sorry, this is just a personal blog site does not offer someone a writer!

                  • avatar Yong 0

                    I’m gone to convey my little brother, that he should also pay a
                    visit this webpage on regular basis to get updated from latest information.

                    • avatar Sabina 0

                      Your style is so unique in comparison to other people I have read stuff from.
                      I appreciate you for posting when you have the opportunity, Guess I’ll
                      just book mark this web site.

                        • avatar xylon 2

                          @Sabina Thank you for your support, I will continue!

                        • avatar Dessie 0

                          This design is spectacular! You certainly know how to
                          keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well,
                          almost…HaHa!) Excellent job. I really enjoyed what you had to say,
                          and more than that, how you presented it. Too cool!

                          • avatar 0

                            Hi, I do think this is a great web site. I stumbledupon it ;
                            ) I may revisit once again since I book-marked it.
                            Money and freedom is the best way to change, may you be rich and continue to help other people.

                            • avatar Antonetta 0

                              Previously, plagiarised content often ranked higher than the original piece.
                              Happy that the script is now working satisfactorily, I check my emails again – another 25 have arrived since I
                              last looked, so I spend 45 minutes sorting them out.
                              The world-wide-web is a fantastic medium from which organizations can attain out to a bigger client base more effortlessly and in a far more successful

                              • avatar 联信资源网 0

                                癸巳年(蛇)七月廿六 2013-9-1