I think you just need to escape those dashes in your regex. But then you've got a tiny bit more work to do before your code lints.
The below code lints, and the regex still checks out at regex101.com (hat tip to torazburo).
/*jslint browser:true */
/*global window */
function phonenumberValidation(inputtext) {
"use strict";
var phonenumber = /[0-9]{3}?[\-.]?[0-9]{3}[\-.]?[0-9]{4}$/;
if (inputtext.value.match(phonenumber)) {
window.alert("Valid Phone Number");
return true;
}
// JSLint used to complain "Unnecessary 'else' after disruption.",
// but that's apparently no longer a requirement.
window.alert("Not a valid Phone Number");
return false;
}
There's a secondary question in here, as @torazaburo also mentions: How do I check for a valid phone number in JavaScript, and it's got a number of answers on StackOverflow already.
I'm kind of partial to this one, though, to be clear, I've never used the library. It is Google's, though, and it's recently modified, so there's a pretty good chance it's doing better than whatever we'd come up with here quickly. Good luck.