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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:56:51+00:00 2026-06-15T15:56:51+00:00

I have three urls I have split down to keywords. In JavaScript I want

  • 0

I have three urls I have split down to keywords. In JavaScript I want to see if two of these Urls match two given keywords. Both keywords have to match two of the url’s for the code to proceed but I can’t think of a short way to do it.

I have tried…

if (url1 || url2 || url3 === "keyword1" && "keyword2") {
....
}

And

if (url1 || url2 || url3 === "keyword1" && url1 || url2 || url3 == "keyword2") {
    ....
    }

This is as far as I got. The problem is, it returns a match for just one of the keywords instead of only returning a match for both . I have a feeling that not ruling out the first match is causing the second to match the same variable. I hope this makes sense!

Can anybody help me?

  • 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-15T15:56:53+00:00Added an answer on June 15, 2026 at 3:56 pm

    If you combine all url values into a single array you can use .indexOf() (the page includes a compatible version if a browser doesn’t support this relatively new method).

    var urls = [url1, url2, url3];
    
    if (urls.indexOf('keyword1') >= 0 && urls.indexOf('keyword2') >= 0) {
        // both keywords are in there somewhere
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have many urls(string): $one = 'http://www.site.com/first/1/two/2/three/3/number/342'; $two = '/first/1/two/2/number/32'; $three = 'site.com/first/1/three/3/number/7'; $four
I have three url pattern match to the same url name url(r'^report/newreport/(?P<number>\w+)/$', 'report.views.newreport',name='report_newreport'), url(r'^report/newreport/(?P<number>\w+)/(?P<edit>\w+)/$',
I have split some pages in between subdomains and want to do a URL
Have three divs in a container that I want to float over a large
I have three tables (individuals, groups & recordlabels) and want use the information between
I want to have same url pattern as khanacademy.org have in its videos. Suppose
I have a huge string of multiple URLs in javascript which is of the
Have three classes User, Group and Field. Many to many relationship on User /
i have three lists with the same number of elements in each other, i
I have three separate table variables in my Function, 1 of them is not

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.