J
Jivanmukta
Hello,
I am learning JavaScript and I have a question concerning constants in
JavaScript:
Why JSLint (http://www.jslint.com/) reports error on the following code:
const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/;
const reDate = /^(\d{4})(\/|-|\.)(\d{1,2})(\/|-|\.)(\d{1,2})$/;
var error_message;
var focus_on;
function getElementValue(elem)
{
if (elem.tagName == 'input' && elem.length)
for (var i = 0, len = elem.length; i < len; i++)
if (elem.checked)
{
elem = elem;
break;
}
return elem.value;
}
....
JSLint reports:
Problem at line 1 character 1: Expected an identifier and instead
saw 'const'.
const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/;
Problem at line 1 character 7: Stopping, unable to continue. (0% scanned).
Is the syntax I use correct? If not, how to write it?
Please help. Thank you!
I am learning JavaScript and I have a question concerning constants in
JavaScript:
Why JSLint (http://www.jslint.com/) reports error on the following code:
const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/;
const reDate = /^(\d{4})(\/|-|\.)(\d{1,2})(\/|-|\.)(\d{1,2})$/;
var error_message;
var focus_on;
function getElementValue(elem)
{
if (elem.tagName == 'input' && elem.length)
for (var i = 0, len = elem.length; i < len; i++)
if (elem.checked)
{
elem = elem;
break;
}
return elem.value;
}
....
JSLint reports:
Problem at line 1 character 1: Expected an identifier and instead
saw 'const'.
const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/;
Problem at line 1 character 7: Stopping, unable to continue. (0% scanned).
Is the syntax I use correct? If not, how to write it?
Please help. Thank you!