How do I get the output of // sololearn, from the following code? Because when I study, regexp test () only produces boolean! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I get the output of // sololearn, from the following code? Because when I study, regexp test () only produces boolean!

https://code.sololearn.com/WcRgyaPOV3JQ/?ref=app

1st Oct 2018, 10:58 AM
Dwirachmat Hariwijaya
Dwirachmat Hariwijaya - avatar
3 Answers
0
Must with function test(),
1st Oct 2018, 11:20 AM
Dwirachmat Hariwijaya
Dwirachmat Hariwijaya - avatar
0
RegExp.test method can only return a boolean to get more information use RegExp.exec method instead: function regex(value){ console.log(/sololearn/.exec(value)); } regex ('sololearn')
1st Oct 2018, 12:10 PM
MO ELomari
- 1
function regex(value){ console.log (value); } regex ('sololearn')
1st Oct 2018, 11:12 AM
Ilias
Ilias - avatar