0
What does the statement mean???
var p = /\d+/g;
4 Answers
+ 8
All the JavaScript code that you will write will, for the most part, be comprised of many separate statements.
A statement can set a variable equal to a value. A statement can also be a function call,
i.e. document. write().
Statements define what the script will do and how it will be done.
+ 6
Regular expressions(RegExp) tutorial:
https://www.sololearn.com/learn/9704/?ref=app
In Javascript there are two ways to create a RegExp:
var re = new RegExp ("\\d+", "g");
Or using a regexp literal as in your statement.
var re = /\d+/g;
This will get you deeper.
https://code.sololearn.com/Wx88zgigVueq/?ref=app
https://code.sololearn.com/W6UCupGsRwzB/?ref=app
+ 2
It's a regular expression, (regex, re, regexp)
/pattern/modifiers
Where \d+ is the pattern and g is a modifier
\d means any digit from 0 to 9
+ means match any that contains at least 1
g means global, find all matches, don't stop at 1st match found
https://www.w3schools.com/jsref/jsref_obj_regexp.asp
+ 2
Shubham Prasad statement means an important line of programs that carrys information and various processes.