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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:51:48+00:00 2026-06-17T06:51:48+00:00

Possible Duplicate: Getting index of an array’s element based on it’s properties I’m working

  • 0

Possible Duplicate:
Getting index of an array’s element based on it’s properties

I’m working on creating an address book with HTML, jQuery, JS, CSS, all the normal stuff. It’s just a simple C.R.U.D. app, nothing fancy. I’m at an intermediate level and having a little bit of trouble with the method in which I’m going about creating it. I’m making each person in the book be an object. Each object is created with a name such as obj0. Then that object would be assigned values such as:

obj0.name = "Billy";
obj0.num = "1-207-233-8846";
obj0.address = "18 Phillmore Rd, Miami, Florida";

If any of those properties wouldn’t work then disregard it, I just made them up for the purpose of an example.

Now I’m realizing that I will most likely need to find which object has the name "Billy". I don’t want to make the user have to enter in obj0 to find Billy.

I’m naming the object obj0 rather than Billy because I want to make it possible to have more than one Billy in the address book.

Okay,now for the actual question:
How would I get the name or id (I want to get obj0 in case that’s unclear) of the object that has the name property of "Billy".

Assume that I have more than one object. The others would be called obj1 and obj2.

If possible I would also like to be able to search for the object with the number of "1-207-233-8446" or other phone numbers/addresses.

  • 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-17T06:51:49+00:00Added an answer on June 17, 2026 at 6:51 am

    Why do you call the objects anything at all? obj0, obj1, etc…

    Consider (unless you’re satisfied with the links to the right, which probably already answers this):

    function Person( name, num, address ) {
        this.name = name;
        this.num = num;
        this.address = address;
    }
    

    then you create an array of such objects:

    var persons = [
        new Person( "Billy", "1-207-233-8846", "18 Phillmore Rd, Miami, Florida" ),
        new Person( "Bob", "2", "somewhere" )
    ];
    

    and searching it becomes easy:

    for ( var i = 0; i < persons.length; ++i ) {
        if ( persons[ i ].name == "Billy" ) {
            // Found, do something with Billy
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Getting the ID of the element that fired an event using JQuery
Possible Duplicate: Getting the ID of the element that fired an event using jQuery
Possible Duplicate: Getting jQuery-inserted DOM elements without requerying for element after insertion Is there
Possible Duplicate: Getting the ID of the element that fired an event using JQuery
Possible Duplicate: Getting ‘undefined index’ error while trying to use $_FILE in PHP I
Possible Duplicate: Getting the submatrix with maximum sum? Given a 2-dimensional array of positive
Possible Duplicate: Getting text within element excluding decendants I'm trying to use :not and
Possible Duplicate: Getting Started with Windows Phone 7 I am new to creating Windows
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index i am getting ranksection
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” I am getting warnings.

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.