JavaScript is_integer function

A JavaScript equivalent of PHP’s is_integer
function is_integer (mixed_var) {
  // http://kevin.vanzonneveld.net
  // +   original by: Paulo Freitas
  //  -   depends on: is_int
  // %        note 1: 1.0 is simplified to 1 before it can be accessed by the function, this makes
  // %        note 1: it different from the PHP implementation. We can't fix this unfortunately.
  // *     example 1: is_integer(186.31);
  // *     returns 1: false
  // *     example 2: is_integer(12);
  // *     returns 2: true
  return this.is_int(mixed_var);
}

Example 1
is_integer(186.31);

Should return
false

Example 2
is_integer(12);

Should return
true
Теги:
is_integer
Добавлено: 27 Июля 2018 22:34:10 Добавил: Андрей Ковальчук Нравится 0
Добавить
Комментарии:
Нету комментариев для вывода...