Jump to content

iwato

Members
  • Content Count

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. QUESTION: How does one change the name of a variable iteratively?BACKGROUND: During an iteration I extract information from a string based on a matched pattern. This pattern repeats itself in the same string a different number of times depending on the string that is matched. With each occurrence of the pattern in the same string is associated new information. My goal is to capture this information and assign it to a uniquely identified variable. Because the number of times that the pattern repeats itself is neither known, nor fixed, the number of uniquely identified variables for each s
  2. iwato

    Casting

    var x = "123";var y = "xyz";x = parseFloat(x, 10);y = parseFloat(y, 10); Yes, I had forgotten about the parseFloat() method, perhaps because of its complexity and specificity to more sophisticated mathematical manipulations. In any case, as Ingolme explained, when making a comparison even strings are permissible. if (isNaN(x)) alert("x is not a number");else if (isNaN(y)) alert("y is not a number");else alert(x + y); So, why do you not use the try, throw and catch construct? My comparison, by the way, is made in just such a pattern, and it works great. You can use the same error messa
  3. iwato

    Casting

    QUESTION: How does one convert a string variable to a number variable for the purpose of numerical comparison?BACKGROUND: In Flash's ActionScript it was possible to cast a string-type variable as a number-type variable to facilitate numerical comparisons. How does one go about this in Javascript?Roddy
×
×
  • Create New...