Are you ready?
1 questions to solve.
- This quiz goes to full-screen once you press the Start button, or any Next button after exiting the quiz window.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
/+/will give a positive result on all strings that contain a sequence of the characters
Which of the following expressions matches all of these?
/[a-d]/imatches a single character from a to d, or A to D. Similarly,
/[abcdABCD]/matches a single character from a to d, or A to D. Hence both expressions are identical.
/[a-Z]/has an invalid range because a lowercase
ais followed by an uppercase
Z, which is wrong.
strafter the following code is run?
var str = "230 = 100 + 130"; var patt = /[100-200]/g; str = str.replace(patt, "o");
/[100-200]/g;matches all the characters
'2'. Unlike the false perception, it doesn't match the numbers from
This means that after running the code here,
strwill become equal to
"o3o = ooo + ooo", as each matched character is replaced with an
/bo[^x-z]/matches all substrings except for
"1544200-48445968-89"does the expression
/[2-5-]/gmatches any of the characters:
-. The correct choice is therefore C).