Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
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?
Home
JavaScript
Syntax for creating a RegExp object: 1. var txt=new RegExp(pattern,attributes); 2. var...
0
votes
asked
Oct 9, 2022
in
JavaScript
by
Robin
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
javascript
code
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 9, 2022
by
Robin
Answer:- C
reason:- Both the statement are correct.
Both the syntax can be used for creating a RegExp object.
...