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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:13:11+00:00 2026-05-20T10:13:11+00:00

I have an array with about 20 elements, and I need to do a

  • 0

I have an array with about 20 elements, and I need to do a few if statements while looping through this array and I need help in creating this if statement in the sense that i need to be able to search if the string contains some text in an efficient way that won’t hang up the whole app.

var locations = [
                   ['Maryland', 'USA', 'Pentium IV', 120, '1 GB', '15"'],
                   ['New York', 'USA', 'Pentium IV', 40, '512 MB', '15" and 17"'],
              ['Frankfurt', 'Germany', 'Pentium IV', 100, '2 GB', '17"']
                ];

for (var i = 0; i < locations.length; i++) {
     var ram = locations[4];
     var monitor = locations[5];

     // need help with the if statement below
     if (ram < '1 GB' || monitor.startsWith("15")) {
       // do something
     }
}

i am using pure javascript, no jquery or other frameworks.

thank you very much in advance for your help.

  • 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-20T10:13:11+00:00Added an answer on May 20, 2026 at 10:13 am

    How about

    if (ram.indexOf('GB') >= 0)
    

    This will just check if the word ‘GB’ is contained in the string. If it is, we’re sure it’s 1GB, 2GB, etc. If it’s not, we’re probably talking in MB, since Terabytes of RAM is not used in machines yet.

    Offcourse this depends on what the possible choices of RAM are. Do they come from a (finite) list, or can the users type them themselves?

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

Sidebar

Related Questions

Say I have an array with a couple hundred elements. I need to iterate
I need to have a fixed-size array of elements and to call on them
I need some help understanding how jQuery stores elements. Please have a look at
I have an array of a few million numbers. double* const data = new
I have an array of shorts (short[]) that I need to write out to
I need an advice about how to create new string array from 4 different
I need to have a dynamic array, so I need to allocate the necessary
I have been pondering about my homework question for a while. I welcome (and
I have to do a project about the periodic table of elements. My dilemma
I have an array list called str, i want to see how many elements

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.