0

i'm facing a problem using match() function in javascript to match a regex expression, when i call the function 2 times, the first call work but the second trigger is not function error.

Here is my code:

in my mixin.js file i have this:

function isNumber(params) {
    var regex = /^[0-9]+$/

    console.log(params);

    if (!params.match(regex)) {
        return false
    } else {
        return true
    }
}

export { isNumber }

and i'm trying to test if it's work by importing this function and call it twice :

import { isNumber } from '../../../mixin'

console.log(isNumber(3))
console.log(isNumber(4))

the first call run without error but the second trigger match is not a function

can someone help me please.

zhulien
  • 5,145
  • 3
  • 22
  • 36
Yousoufos
  • 13
  • 1

0 Answers0