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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:22:17+00:00 2026-06-13T17:22:17+00:00

var value1=50 var value2=140 group 1 a,b a>=42 a<=126 , b>=140 b<=213 a,c a>=42

  • 0
var value1=50
var value2=140

group 1
a,b     a>=42 a<=126    , b>=140 b<=213
a,c     a>=42 a<=126    , c>=1.40 c<=2.13
b,a     b>=140 b<=213   , a>=42 a<=126
c,a     c>=1.40 c<=2.13 , a>=42 a<=126

group 2
d,e     d>=91 d<=443 , e>=58 e<=84
d,f     d>=91 d<=443 , f>=4.8 f<=7
e,d     e>=58 e<=84  , d>=91 d<=443
f,d     f>=4.8 f<=7  , d>=91 d<=443

Need to program this into js so that the two values will check through the ranges of numbers for a suitable number range. Im looking to have it scan through the first group if not successfully finding two ranges to suit both values it checks with the second group.

I have tried a number of different methods for this but i cant work out how to do it?

Help much appreciated

  • 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-13T17:22:18+00:00Added an answer on June 13, 2026 at 5:22 pm

    Something like the following: http://jsbin.com/ipefuf/1/

    It’s a little verbose – could be shortened, but does roughly what you need. Start with it.

    (function(){
    
      var value1=50;
      var value2=140;  
    
      var groups = [
        {
          name: "group 1",
          ranges: [
            { name: "a,b", func: function(a,b){ return a>=42 && a<=126 && b>=140 && b<=213; } },
            { name: "a,c", func: function(a,c){ return a>=42 && a<=126 && c>=1.40 && c<=2.13; } },
            { name: "b,a", func: function(b,a){ return b>=140 && b<=213 && a>=42 && a<=126; } },
            { name: "c,a", func: function(c,a){ return c>=1.40 && c<=2.13 && a>=42 && a<=126; } }
          ]
        },
        {
          name: "group 2",
          ranges: [
            { name: "d,e", func: function(d,e){ return d>=91 && d<=443 && e>=58 && e<=84; } },
            { name: "d,f", func: function(d,f){ return d>=91 && d<=443 && f>=4.8 && f<=7; } },
            { name: "e,d", func: function(e,d){ return e>=58 && e<=84 && d>=91 && d<=443; } },
            { name: "f,d", func: function(f,d){ return f>=4.8 && f<=7 && d>=91 && d<=443; } }
          ]
        }
      ];
    
      var inRange = false;
    
      for(var groupIndex in groups)
      {
        var group = groups[groupIndex];    
    
        for(var rangeIndex in group.ranges)
        {
          var range = group.ranges[rangeIndex];      
          inRange = range.func(value1, value2);
    
          if(inRange)
          {
            alert("Group: " + group.name + ", Range: " + range.name);
            break;
          }      
        }
    
        if(inRange)
        {
          break; 
        }
      }
    
      if(!inRange)
      {
        alert("Not in range."); 
      }
    
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

myList contains the following values: value1 value2 value3 function showArray() { var txt =
I have a structure like this: var var1 = { array1 : ['value1','value2', ...],
I have the object var dataformdata={key1:value1,key2:value2}; then I add some more values with the
The following is the code: function compare(value1, value2){ return (value1-value2); }; var values =
I have the following object: var object = { property1: value1, property2: value2, subobject:
I have this object in JS: var list = {134 : A,140 : B,131
Given I have: $(a.clickable).livequery('click', (function (e) { var values = $(this).attr('id').split('_'); $('#' + values[3]).load($(this).attr('href'));
I have a LINQ query that pulls ID values with integers: var data =
I am using the following code to submit different values var evalue= 'color:#d32;font-size:12px;'; jQuery.ajax({
Let's say I have this javascript: <script language=javascript type=text/javascript> function addtext() { var newtext

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.