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 8869303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:27:27+00:00 2026-06-14T17:27:27+00:00

Possible Duplicate: How to remove a property from a javascript object JavaScript Hashmap Equivalent

  • 0

Possible Duplicate:
How to remove a property from a javascript object
JavaScript Hashmap Equivalent

I am using jQuery and I am handling a variable this way:

var array = {};

array[an_object]      = something
array[another_object] = something_else
array[...]            = ...

When I try to run the splice method on the array I get a TypeError: array.splice is not a function. My intent is to remove the an_object “key” and all its content from the array variable.

How can I make that?


Note: When I run the console.log(array[an_object]) (the same is valid for another_object and all other objects) I get:

[Object { label="str1",  value=1 }, Object { label="str2",  value=2 }, { label="strN",  value=N }]
  • 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-06-14T17:27:28+00:00Added an answer on June 14, 2026 at 5:27 pm

    First of all, name your variables what they are. The name array you’re using, is misleading if you use it to create a object.

    var myObject = {};
    
    myObject[an_object]      = "xyz";
    myObject[another_object] = "abc";
    

    Now, you can delete the entry in the object with the delete statement:

    delete myObject[an_object]; // Returns true / false if the deletion is a success / failure
    console.log(myObject[an_object]) // Returns undefined
    

    Now, that said, this will not work like you’d expect. myObject[an_object] will contain “abc”
    Don’t use objects as keys. Use strings, instead.
    This is because of the fact that any parameter entered in the [] will be converted to string. So actually, you’re entering myObject["[object Object]"]

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

Sidebar

Related Questions

Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: how to remove css property using javascript? I have this javascript: var
Possible Duplicate: Remove non breaking space ( ) from between elements using jquery How to
Possible Duplicate: How to remove a property from an object? I am comparing two
Possible Duplicate: Standard way to remove multiple elements from a dataframe I know in
Possible Duplicate: Removing multiple classes (jQuery) how can we remove multiple classes from one
Possible Duplicate: How to remove a cookie by using Javascript? javascript:void(document.cookie=PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/; domain=.google.com); How to
Possible Duplicate: remove application icon from the taskbar using .net with c# I am
Possible Duplicate: Check checkbox checked property using jQuery I am having an issue picking
Possible Duplicate: Remove text with jQuery I want to remove the text from a

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.