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

  • Home
  • SEARCH
  • 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 7646329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:10:48+00:00 2026-05-31T10:10:48+00:00

If I can access an object from an object using list[value][index] , how can

  • 0

If I can access an object from an object using list[value][index], how can I delete or unshift that object from list without using delete? (since that isn’t possible in an object list)

My object looks like this:

var list = {
    'test1': [
        {
            example1: 'hello1'
        },
        {
            example2: 'world1'
        }
    ]
    'test2': [
        {
            example1: 'hello2'
        },
        {
            example2: 'world2'
        }
    ]
};

After deleting an object, I want it to look like this:

var list = {
    'test1': [
        {
            example1: 'hello1'
        }
    ]
    'test2': [
        {
            example1: 'hello2'
        },
        {
            example2: 'world2'
        }
    ]
};

When I use delete, it looks like this:

var list = {
    'test1': [
        {
            example1: 'hello1'
        },
        null
    ]
    'test2': [
        {
            example1: 'hello2'
        },
        {
            example2: 'world2'
        }
    ]
};
  • 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-31T10:10:49+00:00Added an answer on May 31, 2026 at 10:10 am

    You can remove the object from list by setting the value of list[key] to undefined. This won’t remove the key, however – you’d need delete to do that:

    list['test1'] = undefined; // list is now { test1: undefined, test2: [ ... ]}
    delete list['test1']; // list is now { test2: [ ... ] }
    

    Is there a particular reason you don’t want to use delete? It won’t make a difference if you’re just checking list['test1'] for truthiness (e.g. if (list['test1']) ...), but if you want to iterate through list using for (var key in list) or something like that, delete is a better option.

    EDIT: Ok, it looks like your actual question is “How can I remove a value from an array?”, since that’s what you’re doing – the fact that your array is within an object, or contains objects rather than other values, is irrelevant. To do this, use the splice() method:

    list.test1.splice(1,1); // list.test1 has been modified in-place
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way i can access the page object from within the global.asax
I can access the database either from a .NET program (using ODBC) or through
Can anyone let me know how can access an element of a list that
I am using rpy2 for regressions. The returned object has a list that includes
Is it possible to get list of all existing accounts from Outlook 2003 using
I'm using an object from a 3rd party API that has a property of
How can I access Class object for Generics? Currently, I am doing it this
I have an object created in a host application and can access it remotely
Can I avoid instantiate a Db object inside of Names object to access it
I can access Spring beans in my Servlets using WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); in

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.