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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:11:30+00:00 2026-06-12T19:11:30+00:00

I know that delete is a keyword in JavaScript. So I have this code

  • 0

I know that delete is a keyword in JavaScript. So I have this code (for example):

var user = {
   create : function () {
       // Create a user account
   },

   delete : function () {
       // Delete a user account
   }
};

The above works (barring older versions of IE), so my question is – is it a good idea. Obviously the call user.delete(); is much clearer to someone utilizing the code than something like user.delete_one();

Obviously keywords are important, but on a case by case basis is it alright (granted I don’t need legacy IE support) to use this method, or is there a better solution?

  • 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-12T19:11:31+00:00Added an answer on June 12, 2026 at 7:11 pm

    You code will work as expected, because you are not overwriting JS keyword. If you try to declare a keyword as variable or function name, JS will show error SyntaxError: Unexpected token delete.

    It ‘s alright with the way you choose but don’t override JS keywords directly.

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

Sidebar

Related Questions

I know that you cannot delete a cookie set by another server in javascript.
I know that this line of code will make the cell text-wrap: $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setWrapText(true); 'D1'
I know that the following code will delete the record with id = 5
I know that it's possible to say delete this in C++ whenever you allocated
I think I read that the delete trigger doesn't know what data was deleted
Example: before: text_before_specific_character(specific_character)text_to_be_deleted after: text_before_specific_character I know that it can be done with sed
I know that this sort of question has been asked here before, but still
I know that Java have its own garbage collection, but sometimes I want to
I know that delete ing a null pointer is a no-op: In either alternative,
I know from reading parashift.com that using delete on a pointer frees the memory

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.