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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -