Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Data Structures: How to Remove Items?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 275
    Answer it

    Hi. 

    Is there an order of operations of sort when de-constructing or constructing arrays?

    Example: I have a n array with eight numbers. I want to .shift( ) the the first number in index "0" then .splice( ) the last five numbers. 

    So, my questions is, does the .shift( ) occur first and then the .splice( ) and should I start the index position after result of the .shift( )? I hope this makes sense. Thank you.

    1   const arr = [2, 4, 5, 1, 7, 5, 2, 1];

    2   arr.shift(0);

    3   arr.splice(3,5);

    4   console.log(arr);

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: