Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    Roanoke, VA, US
    Posts
    390

    wildcard operator for javascript?

    I have the following--

    Code:
    var fieldRequired = Array("bitten[1]", "aggression[1]", "luxuryBath[1]");
    I need to basically make any item in the array that contains any number between the [ ] required. So basically in this instance--

    var fieldRequired = Array("bitten[x]", "aggression[x]", "luxuryBath[x]");

    I need 'x' to be a wildcard operator. Is this possible in JS?

  2. #2
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,104
    To put it very bluntly, no. You need to rethink your approach to this problem.

  3. #3
    Join Date
    Oct 2004
    Location
    Moji
    Posts
    2,107
    ummm
    if I got it right,
    can't you use this?
    Code:
    var x = "some value";
    var fieldRequired = Array(
            "bitten["+x+"]", 
            "aggression["+x+"]", 
            "luxuryBath["+x+"]"
    );
    Assuming that brackets doesn't mean an array.
    DigiPun.ch
    An Awesome Digital Punch Clock
    Release date: October 1st

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •