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.

Related questions

0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
+1 vote
asked Mar 22, 2021 in JavaScript by Robindeniel
...