0 votes
in JavaScript by
Syntax for creating a RegExp object:

1. var txt=new RegExp(pattern,attributes);

2. var txt=/pattern/attributes;

Which of the above mentioned syntax will correct?

a) 1 only

b) 2 only

c) Both 1 and 2

d) None of the above

1 Answer

0 votes
by
Answer:-  C

reason:- Both the statement are correct.

Both the syntax can be used for creating a RegExp object.
...