Why doesn't a regex pattern qualify as a javascript data type? -
var rclass = /[\n\t\r]/g;
in above, there no ""
, or ''
around it, cannot string, not own data type? why not qualify?
also, why not put ""
, ''
around , represent string?
in javascript can create things in 2 ways.
either calling constructor function:
var myconstructedstring = new string( "foo" ); var myconstructedregexp = new regexp("[\n\t\r]", "g");
or using literals:
var myliteralstring = "bar"; var myliteralregexp = /[\n\t\r]/g;
regular expressions no exception. date 1 type (date not being type sub type of object type) has no literal notation.
so answer 1 of questions, "is not own data type?". no it´s not, regexp of type object, date , math. there 6 types in javascript
a read this article @ mdn.
Comments
Post a Comment