Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Javascript only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Javascript
Check the end of an integer/float variable
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
wangers16
New Member
Join Date:
Jul 2007
Posts:
57
#1
Check the end of an integer/float variable
Sep 15 '09, 11:51 PM
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
Join Date:
May 2007
Posts:
5390
#2
Sep 16 '09, 02:53 AM
you might use a regExp for that ... like in the following example:
Code:
var n = 4.63435; /5$/.test(n)
kind regards
Comment
Post
Cancel
Dheeraj Joshi
Recognized Expert
Top Contributor
Join Date:
Jul 2009
Posts:
1129
#3
Sep 16 '09, 02:58 AM
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
Post
Cancel
wangers16
New Member
Join Date:
Jul 2007
Posts:
57
#4
Sep 17 '09, 12:29 AM
Thank you, it is working brilliantly :)
Comment
Post
Cancel
gits
Recognized Expert
Moderator
Expert
Join Date:
May 2007
Posts:
5390
#5
Sep 17 '09, 03:41 PM
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
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment