Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3454798
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:32:10+00:00 2026-05-18T09:32:10+00:00

I was experimenting with the splice() method in jconsole a = [1,2,3,4,5,6,7,8,9,10] 1,2,3,4,5,6,7,8,9,10 Here,

  • 0

I was experimenting with the splice() method in jconsole

a = [1,2,3,4,5,6,7,8,9,10]
1,2,3,4,5,6,7,8,9,10

Here, a is a simple array from 1 to 10.

b = ['a','b','c']
a,b,c

And this is b

a.splice(0, 2, b)
1,2
a
a,b,c,3,4,5,6,7,8,9,10

When I pass the array b to the third argument of splice, I mean “remove the first two arguments of a from index zero, and replace them with the b array”. I’ve never seen passing an array as splice()’s third argument (all the guide pages I read talk about a list of arguments), but, well, it seems to do the trick. [1,2] are removed and now a is [a,b,c,3,4,5,6,7,8,9,10]. Then I build another array, which I call c:

c = ['one','two','three']
one,two,three

And try to do the same:

a.splice(0, 2, c)
a,b,c,3
a
one,two,three,4,5,6,7,8,9,10

This time, 4 (instead of 2) elements are removed [a,b,c,3] and the c array is added at the beginning. Someone knows why? I’m sure the solution is trivial, but I don’t get it right now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:32:11+00:00Added an answer on May 18, 2026 at 9:32 am

    Array.splice does not support an array as the third parameter.
    Reference: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice

    Using Firebug (or Chrome’s Console), one sees what really happens:

    a.splice(0, 2, b)
    > [1, 2]
    a
    > [["a", "b", "c"], 3, 4, 5, 6, 7, 8, 9, 10]
    

    Problem here is jconsole, which just uses toString() to print out the arrays, but Array.toString() does not print any [].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While experimenting a bit with C++ templates I managed to produce this simple code,
Experimenting with Cocos2D collection detection and have some questions. First, some background: This is
I'm experimenting with new bindings for basic movement in Emacs. Borrowing from this page
While experimenting with this question on collections in Spring.NET , I discovered that Spring
Experimenting with JsHelper in CakePHP 2.0, I got a Request method to update the
Experimenting with new features of T-SQL, I've run into a puzzle. Here is some
im experimenting in getting camel to do some file operations and pass them through
Was experimenting with interface inheritance and found this: interface String{} interface Object{} interface Exception{}
In experimenting with this question I created an example that I utterly do not
In experimenting with pickle, I've put together some code for a (very) simple blog.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.