In declaring values we can do:
var x, // comment
y, // comment
z; // comment
and that's ok. I have this a little bit longer regExp (I am still introducing myself to regExp) which I am not used to do, which works
var pattern = /^(1\s?)?(\(\d{3}\)|\d{3})[\s\-]?\d{3}[\-\s]?\d{4}$/;
but when I try to do it like I did on my variables declaration example:
var pattern = /^(1\s?)? // optional 1 with space or nonspace; also optional
(\(\d{3}\)|\d{3}) // optional () bracket in 3 digits
[\s\-]? // optional space and dash
\d{3} // 3 digits
[\-\s]?
\d{4}$/; // 4 digits
The above code will not work, but I only want to do this for my learning purposes. Is it possible to do?