[Plugin] samp.js - JavaScript for SA-MP
#78

Quote:
Originally Posted by Omer.
View Post
Code:
var IsNumeric = function(input) {
    return (input - 0) == input && (''+input).trim().length > 0;
};
I like the ReturnUser function.

You can simply:
Code:
var IsNumeric = function(test) {
    return (isNaN(parseFloat(test)) == false && isFinite(test) == true);
}
That way you can also test if a string "123" is a number or even a float "69.1994".

Quote:

print([ IsNumeric("test"), IsNumeric(true), IsNumeric("69"), IsNumeric("19.94") ]); // { 0: false, 1: false, 2: true, 3: true }

Reply


Messages In This Thread
samp.js - JavaScript for SA-MP - v0.1.9.4 - by !damo!spiderman - 02.07.2015, 05:38
Re: samp.js - JavaScript for SA-MP - by RuNBoY - 02.07.2015, 05:43
Re: samp.js - JavaScript for SA-MP - by ev0lution - 02.07.2015, 05:45
Re: samp.js - JavaScript for SA-MP - by Ritzy2K - 02.07.2015, 09:33
AW: samp.js - JavaScript for SA-MP - by FSAOskar - 02.07.2015, 11:54
Re: AW: samp.js - JavaScript for SA-MP - by !damo!spiderman - 02.07.2015, 12:20
Re: samp.js - JavaScript for SA-MP - by theYiin - 02.07.2015, 12:30
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 02.07.2015, 12:34
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 02.07.2015, 12:56
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 02.07.2015, 13:17
Re: samp.js - JavaScript for SA-MP - by ev0lution - 03.07.2015, 05:50
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 03.07.2015, 14:54
Respuesta: samp.js - JavaScript for SA-MP - by [DOG]irinel1996 - 03.07.2015, 16:01
Re: samp.js - JavaScript for SA-MP - by BonhommeG - 03.07.2015, 16:23
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 03.07.2015, 16:43
Re: samp.js - JavaScript for SA-MP - by ev0lution - 04.07.2015, 00:56
Re: samp.js - JavaScript for SA-MP - by ev0lution - 04.07.2015, 08:43
Re: samp.js - JavaScript for SA-MP - by Crayder - 04.07.2015, 08:54
Re: samp.js - JavaScript for SA-MP - by BonhommeG - 04.07.2015, 12:06
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 04.07.2015, 12:10
Re: samp.js - JavaScript for SA-MP - by BonhommeG - 04.07.2015, 12:38
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 04.07.2015, 12:45
Re: samp.js - JavaScript for SA-MP - by GWMPT - 04.07.2015, 12:46
Re: samp.js - JavaScript for SA-MP - by BonhommeG - 04.07.2015, 13:02
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 04.07.2015, 13:06
Re: samp.js - JavaScript for SA-MP - by prineside - 05.07.2015, 10:38
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 05.07.2015, 14:13
Re: samp.js - JavaScript for SA-MP - by Kapersky™ - 05.07.2015, 15:02
Re: samp.js - JavaScript for SA-MP - by PeterJane - 05.07.2015, 19:47
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 05.07.2015, 23:37
Re: samp.js - JavaScript for SA-MP - by PeterJane - 06.07.2015, 13:15
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 11.07.2015, 04:37
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 12.07.2015, 15:08
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 13.07.2015, 05:28
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 15.07.2015, 02:19
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 16.07.2015, 10:18
Re: samp.js - JavaScript for SA-MP - by KayJ - 16.07.2015, 13:05
Re: samp.js - JavaScript for SA-MP - by iFrame - 16.07.2015, 14:41
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 20.07.2015, 15:19
Re: samp.js - JavaScript for SA-MP - by Laronic - 22.07.2015, 23:18
Re: samp.js - JavaScript for SA-MP - by Crayder - 22.07.2015, 23:38
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 23.07.2015, 01:27
Re: samp.js - JavaScript for SA-MP - by benel1 - 26.07.2015, 14:19
Re: samp.js - JavaScript for SA-MP - by BlackBank - 26.07.2015, 17:03
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 26.07.2015, 18:24
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 26.07.2015, 18:26
Re: samp.js - JavaScript for SA-MP - by Laronic - 04.08.2015, 17:25
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 05.08.2015, 12:28
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 05.08.2015, 13:27
Re: samp.js - JavaScript for SA-MP - by Lorenc_ - 05.08.2015, 14:13
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 05.08.2015, 19:08
Re: samp.js - JavaScript for SA-MP - by Battlezone - 24.08.2015, 19:03
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 25.08.2015, 05:15
Re: samp.js - JavaScript for SA-MP - by ev0lution - 25.08.2015, 05:18
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 25.08.2015, 05:21
Re: samp.js - JavaScript for SA-MP - by prineside - 05.09.2015, 21:06
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 06.09.2015, 08:59
Re: samp.js - JavaScript for SA-MP - by ChromeAmazing - 06.09.2015, 21:42
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 12.09.2015, 18:12
Re: samp.js - JavaScript for SA-MP - by j0n - 17.09.2015, 17:12
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 17.09.2015, 17:37
Re: samp.js - JavaScript for SA-MP - by HardWar - 17.09.2015, 18:49
Re: samp.js - JavaScript for SA-MP - by Kamper - 17.09.2015, 22:54
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 18.09.2015, 08:07
Re: samp.js - JavaScript for SA-MP - by Mowgli - 18.09.2015, 08:36
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 18.09.2015, 10:28
Re: samp.js - JavaScript for SA-MP - by HardWar - 18.09.2015, 16:40
Re: samp.js - JavaScript for SA-MP - by !damo!spiderman - 19.09.2015, 07:59
Re: samp.js - JavaScript for SA-MP - by Kamper - 19.09.2015, 11:38
Re: samp.js - JavaScript for SA-MP - by Omer. - 22.09.2015, 20:45
Re: samp.js - JavaScript for SA-MP - by DRIFT_HUNTER - 23.09.2015, 18:11
Re: samp.js - JavaScript for SA-MP - by Omer. - 23.09.2015, 18:56
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 29.09.2015, 01:44
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 04.10.2015, 01:37
Re: samp.js - JavaScript for SA-MP - by Abagail - 04.10.2015, 03:10
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 04.10.2015, 03:46
Re: samp.js - JavaScript for SA-MP - by Omer. - 27.10.2015, 07:50
Re: samp.js - JavaScript for SA-MP - by SkittlesAreFalling - 28.10.2015, 00:14
Re: samp.js - JavaScript for SA-MP - by Omer. - 28.10.2015, 04:08
Re: samp.js - JavaScript for SA-MP - by Anarkien - 19.06.2016, 08:54
Re: samp.js - JavaScript for SA-MP - by CoaPsyFactor - 20.06.2016, 16:56
Re: samp.js - JavaScript for SA-MP - by Pyrotech - 10.10.2016, 00:05
Re: samp.js - JavaScript for SA-MP - by CoaPsyFactor - 13.10.2016, 13:08
Re: samp.js - JavaScript for SA-MP - by Yaa - 23.11.2016, 12:02
Re: samp.js - JavaScript for SA-MP - by LifeIsGood - 24.11.2016, 07:37
Re: samp.js - JavaScript for SA-MP - by Yaa - 24.11.2016, 12:58
Re: samp.js - JavaScript for SA-MP - by lepegadore - 16.01.2017, 11:45
Re: samp.js - JavaScript for SA-MP - by Omer. - 12.02.2017, 12:02
Re: samp.js - JavaScript for SA-MP - by PhamHoang - 14.07.2017, 06:32
Re: samp.js - JavaScript for SA-MP - by NekoriDes - 02.12.2017, 22:26
Re: samp.js - JavaScript for SA-MP - by Kaperstone - 03.12.2017, 04:57
Re: samp.js - JavaScript for SA-MP - by LifeIsGood - 03.12.2017, 05:06
Re: samp.js - JavaScript for SA-MP - by Kaperstone - 03.12.2017, 05:58

Forum Jump:


Users browsing this thread: 10 Guest(s)