I can check the validation of the number, How can I change to string in the same function?
hasValidPhone: function() {
var isValidPhone = /^\+?[\d-|,|]{7,15}$/.test(this.val());
return this.length > 0 ? isValidPhone : false;
},
I can check the validation of the number, How can I change to string in the same function?
hasValidPhone: function() {
var isValidPhone = /^\+?[\d-|,|]{7,15}$/.test(this.val());
return this.length > 0 ? isValidPhone : false;
},
toString()
function
– roberto06
Commented
Feb 10, 2017 at 13:45
You can do the following
var n = 14;
n.toString();
or
var n = String(14);
or
var n = 14+"";
var yourVar = String(this.val());
You can simply toSring function like this -
var num = 15;
var n = num.toString();