Check the end of an integer/float variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wangers16
    New Member
    • Jul 2007
    • 57

    Check the end of an integer/float variable

    Is it possible to get JavaScript to check the end of the a integer/float variable for a certain number e.g. 5, if so how do you do it?

    Thanks in advance
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    you might use a regExp for that ... like in the following example:

    Code:
    var n = 4.63435;
    
    /5$/.test(n)
    kind regards

    Comment

    • Dheeraj Joshi
      Recognized Expert Top Contributor
      • Jul 2009
      • 1129

      #3
      GITS is right... Use regular expressions... You can get the regular expressions in the Internet or you can write your own...

      See this Link RegEx

      Regards
      Dheeraj Joshi

      Comment

      • wangers16
        New Member
        • Jul 2007
        • 57

        #4
        Thank you, it is working brilliantly :)

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          of course :) ... just kidding ... glad to hear that your problem is solved ... just post back to the forum in case you have more questions ...

          kind regards

          Comment

          Working...