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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:59:01+00:00 2026-06-08T17:59:01+00:00

I fully understand Javascript is case sensitive, but when it comes to if statements

  • 0

I fully understand Javascript is case sensitive, but when it comes to if statements Sam does not equal to sam. I created a prompt box calling this function and I would like it to convert sam to Sam or make both True when you type the name into the prompt box.

function search(name) {
var ourContacts = contacts.length;
for (var i = 0; i < ourContacts; i++) {
if (contacts[i].name === name) {
printdog(contacts[i]);
}
}
}

Here is my whole script if you need it for better understandings.

function dog(name, breed, age, color, weight, owner, owneraddress) {
    this.name = name;
    this.breed = breed;
    this.age = age;
    this.color = color;
    this.weight = weight;
    this.owner = owner;
    this.owneraddress = owneraddress;
}
//My Dogs
var sam = {
    name: "Sam",
    breed: "Chihuahua",
    age: 7,
    color: "White",
    weight: "7 lb",
    owner: "Bourton",
    owneraddress: "44 Berkley Drive"
};
var max = {
    name: "Max",
    breed: "Chihuahua",
    age: 4,
    color: "Brown",
    weight: "5 lb",
    owner: "Smith",
    owneraddress: "134 Door Ave"
};

//My array of dogs
var contacts = [sam, max];

function printdog(dog) {
    console.log(dog.name + " " + dog.owner);
}
function list() {
var ourContacts = contacts.length;
for (var i = 0; i < ourContacts; i++) {
printdog(contacts[i]);
}
}
list();
function search(name) {
var ourContacts = contacts.length;
for (var i = 0; i < ourContacts; i++) {
name = name.toLowerCase;
if (contacts[i].name === name) {
printdog(contacts[i]);
}
}
}

<button onclick="search(prompt('Search Dogs Name'))">Search for Dog</button>
  • 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-08T17:59:02+00:00Added an answer on June 8, 2026 at 5:59 pm

    You can use the Javascript .toUpperCase() method on both operands:

    if (contacts[i].name.toUpperCase() === name.toUpperCase())
    

    Alternatively, you can use the .toLowerCase() method on both operands:

    if (contacts[i].name.toLowerCase() === name.toLowerCase())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure I fully understand what phpmyadmin does. I created a database in phpmyadmin,
Please not that I fully understand this is a dumb ass idea, but its
i do not fully understand how to communicate between adobe air (using flex3) and
I do not fully understand classes. I have read the python documentation and several
I am getting a warning I do not fully understand every time I run
I somewhat understand the difference between Javascript and Java when it comes to OOP.
Please understand firstly that I fully understand that Java will return a String when
I am trying to fully understand the process pro writing code in some language
I don't fully understand when to use a workspace. Here is what I have
I was never able to fully understand what is going on in the background

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.