What does the statement mean??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does the statement mean???

var p = /\d+/g;

24th May 2020, 6:50 AM
Shubham Prasad
Shubham Prasad - avatar
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.
24th May 2020, 8:06 AM
Killú
Killú - avatar
+ 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
24th May 2020, 7:11 AM
Kevin ★
+ 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
24th May 2020, 7:13 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Shubham Prasad statement means an important line of programs that carrys information and various processes.
24th May 2020, 11:04 AM
Aryan D'cruz
Aryan D'cruz - avatar