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.
Related questions
0
votes
Q: If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
asked
Oct 9, 2022
in
JavaScript
by
Robin
javascript
code
0
votes
Q: What if we put ++ operator inside if condition? find the output of below code <script> var a = 10; if(a == a++) document.write(a); </script>
asked
Oct 9, 2022
in
JavaScript
by
Robin
javascript
code
0
votes
Q: What is the output of following Javascript? var a = 'letsfind'; var b = 'course'; var c = a/b; document.write(c);
asked
Oct 9, 2022
in
JavaScript
by
Robin
javascript
code
0
votes
Q: Which one of the following options is the correct output for the given code of JavaScript?
asked
Mar 23, 2021
in
JavaScript
by
sharadyadav1986
javascript
output
code
program
0
votes
Q: Which one of the following options is the correct output for the given code of JavaScript?
asked
Mar 23, 2021
in
JavaScript
by
sharadyadav1986
javascript
output
code
0
votes
Q: Which one of the following options is the correct output for the given code of JavaScript?
asked
Mar 23, 2021
in
JavaScript
by
sharadyadav1986
javascript
output
code
+1
vote
Q: Which one of the following options is the correct output for the given code of java script?
asked
Mar 22, 2021
in
JavaScript
by
Robindeniel
javascript
car
code
output
0
votes
Q: Find output of below Javascript addition code document.write("1 plus 1 is " + 1 + 1);
asked
Oct 9, 2022
in
JavaScript
by
Robin
javascript
code
0
votes
Q: What is the output of below Javascript code? alert (typeof new Date() );
asked
Oct 9, 2022
in
JavaScript
by
Robin
javascript
code
+1
vote
Q: To know about an object, whether the object is a prototype (or a part of a prototype chain) of another object, the user can use_______
asked
Mar 22, 2021
in
JavaScript
by
Robindeniel
javascript
operator
code
...