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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:08:37+00:00 2026-05-28T00:08:37+00:00

Why does delete operator return true if I try to delete non existing indexed

  • 0

Why does delete operator return true if I try to delete non existing indexed element of an array?

More precisely deletion of undefined is true in javascript?

var arr = ['a','b','c','d'];

console.log(delete arr[2000]);  //true why?

console.log(delete aaaaa);     //true  why not reference error?

console.log(delete arrr[2000]);  //reference error  it's okay i think

I don’t understand difference between 2nd and 3rd deletion. Both should ideally give reference error.

  • 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-28T00:08:38+00:00Added an answer on May 28, 2026 at 12:08 am

    From the MDN:

    Returns false only if the property exists and cannot be deleted. It
    returns true in all other cases.

    edit:

    here you just delete a in your scope, mostly the window scope

    console.log(delete aaaaa);     //true  why not reference error?
    

    so its the same as:

    console.log(delete window.aaaaa);     //true  
    

    here arrr is undefined and you get an reference error before the delete method is called

    console.log(delete arrr[2000]);  //reference error  it's okay i think 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In java, does file.delete() return true or false where File file refers to a
Does a hash shrink in Perl as you delete elements. More specifically I had
In C++, I understand that the delete operator, when used with an array, 'destroys'
Both free(NULL) and ::operator delete(NULL) are allowed. Does the allocator concept (e.g. std::allocator also
how does the delete operator work? Is it better then free()?. Also if u
Possible Duplicates: How does delete[] “know” the size of the operand array? ( POD
This question was inspired by a similar question: How does delete[] know the size
How does one delete a word to the left? In other words, delete the
In SQL Server 2000, by default, does a DELETE query cause a table's UPDATE
What are possible reasons why NHibernate does not perform delete operation? public bool Delete(MyType

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.