Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: ttomasko
  • Content: Threads
  • Order by date
  1. ttomasko

    How to delete all duplicates in an array

    Hello, I have an array: var a = [1,1,2,2,3,4,4,5,6,6]; I need to delete all the duplicates, i.e., both pairs of each duplicate so that I am only left with the elements that are unique. In the example above the result should be 3, 5. I've tried pushing or splicing to no avail. Any...
  2. ttomasko

    How to preserve values in a multiple iteration

    Hello, I have a script that has three levels of for statements. Right now the end result is that I get returned the last values of each array. What I wish however is to preserve the values of the first and second iterations. var a = [1,2,3]; var b = ["a","b"]; var c = ["x","y","z"]; for(var i...
  3. ttomasko

    Finding the difference between two arrays

    Hello, I will have two arrays of numbers. One will always be a subset of the other. What I want to know is which numbers only appear in the major set and put them in an array: var a = [1,2,3,4,5,6]; var b = [1,2,3,6]; //result I want: [4,5] I have tried concatenating a and b and then looking...
  4. ttomasko

    How to delete all duplicates in two arrays

    Hello, I have been tearing my hair out on how to solve this. I will have an array of numbers. I'll never know the starting and ending numbers but they will be in order. However, there may be gaps in the order. It is the gaps I am interested in. Let's say I start with the following array: var...
  5. ttomasko

    Question about switch statement

    Hello, Is it possible to use the switch statement with inequalities? For instance, the following does not work. Tom var x = 4; switch(x){ case <5: alert("do something"); break; case 5: alert("do something more"); break; case >5: alert("do something really big"); break...
  6. ttomasko

    How to cut short an alert that is way too long

    Hello, I often have to display the elements of an array in an alert box (probably not a good thing on the web but this is for the InDesign program). When there are many elements this creates an alert box that is so long that one cannot find the bottom in order to dismiss the alert. Below is a...
  7. ttomasko

    How to delete duplicate objects in an array

    I have an array of objects, some of which are duplicates. I need to pare this down so that there are only unique objects. I can't show these objects here because they are in the InDesign object model. The best I can do is to make an array of arrays, two of which have equal last elements. The...
  8. ttomasko

    How to search a loop for only certain elements

    Hello, I want to search through an array to make sure all the elements are the same. If so, I want there to be one alert to the user, not as many alerts as there are elements. But if one or more elements do not meet a condition, I want an alert for each of those elements. Below is the script...

Part and Inventory Search

Back
Top