fix(challenges): fix third test for template literals
replaced the overly long and complex regex which tests for use of template literals with a much simpler one that has the same effect ISSUES CLOSED: #135
This commit is contained in:
committed by
Kristofer Koishigawa
parent
e41f0782ea
commit
b8d004e3f2
@ -996,7 +996,7 @@
|
||||
"<blockquote>const person = {<br> name: \"Zodiac Hasbro\",<br> age: 56<br>};<br><br>// Template literal with multi-line and string interpolation<br>const greeting = `Hello, my name is ${person.name}!<br>I am ${person.age} years old.`;<br><br>console.log(greeting); // prints<br>// Hello, my name is Zodiac Hasbro!<br>// I am 56 years old.<br></blockquote>",
|
||||
"A lot of things happened there.",
|
||||
"Firstly, the example uses backticks (<code>`</code>), not quotes (<code>'</code> or <code>\"</code>), to wrap the string.",
|
||||
"Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting \n within strings.",
|
||||
"Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting <code>\n</code> within strings.",
|
||||
"The <code>${variable}</code> syntax used above is a placeholder. Basically, you won't have to use concatenation with the <code>+</code> operator anymore. To add variables to strings, you just drop the variable in a template string and wrap it with <code>${</code> and <code>}</code>. Similarly, you can include other expressions in your string literal, for example <code>${a + b}</code>.",
|
||||
"This new way of creating strings gives you more flexibility to create robust strings.",
|
||||
"<hr>",
|
||||
@ -1017,7 +1017,7 @@
|
||||
{
|
||||
"text": "Template strings were used",
|
||||
"testString":
|
||||
"getUserInput => assert(getUserInput('index').match(/`<li \\s*class\\s*=\\s*(\"\\s*text-warning\\s*\"|'\\s*text-warning\\s*')\\s*>\\s*\\$\\s*\\{(\\s*\\w+\\s*|\\s*\\w+\\s*\\[\\s*[\\w]+\\s*\\]\\s*)\\}\\s*<\\s*\\/li\\s*>`/g), 'Template strings were used');"
|
||||
"getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were used');"
|
||||
}
|
||||
],
|
||||
"releasedOn": "Feb 17, 2017",
|
||||
|
Reference in New Issue
Block a user