Bug in ES6: Create Strings using Template Literals with Err Msg: Invalid regular expression flags
See original GitHub issueDescribe your problem and - if possible - how to reproduce it
The Challenge, ES6: Create Strings using Template Literals, return an error message Invalid regular expression flags.
My solution is,
arr.map(a=>`<li class="text-warning">${a}</li>`);
where the console log shows the correct solution,
["<li class="text-warning">no-var</li>", "<li class="text-warning">var-on-top</li>", "<li class="text-warning">linebreak</li>"]
And the full code is,
const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["id-blacklist", "no-dup-keys"]
};
function makeList(arr) {
"use strict";
// change code below this line
const resultDisplayArray = arr.map(a=>`<li class="text-warning">${a}</li>`);
// change code above this line
return resultDisplayArray;
}
/**
* makeList(result.failure) should return:
* [ <li class="text-warning">no-var</li>,
* <li class="text-warning">var-on-top</li>,
* <li class="text-warning">linebreak</li> ]
**/
const resultDisplayArray = makeList(result.failure);
console.log(resultDisplayArray);
Add a Link to the page with the problem
Tell us about your browser and operating system
- Browser Name: Chrome
- Browser Version: Version 67.0.3396.99 (Official Build) (64-bit)
- Operating System: Win10
If possible, add a screenshot here
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:27 (4 by maintainers)
Top Results From Across the Web
ES6: Create Strings using Template Literals Bug - #22 by ilenia ...
Bug in ES6: Create Strings using Template Literals with Err Msg: Invalid regular ... I have the same problem too, it says Invalid...
Read more >SyntaxError: invalid regular expression flag "x" - MDN Web Docs
The JavaScript exception "invalid regular expression flag" occurs when the flags in a regular expression contain any flag that is not one of:...
Read more >Can ES6 template literals be substituted at runtime (or reused)?
To make these literals work like other template engines there needs to be an intermediary form. The best way to do this is...
Read more >API - esbuild
This API call is used by the command-line interface if no input files are provided and the --bundle flag is not present. In...
Read more >Using ES6 template strings for regular expressions - 2ality
ECMAScript 6 template strings [1] give us multi-line raw (backslash has no special meaning) string literals and interpolation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still buggy… My solution, (though I tried the looping solution and some listed above) No luck
yeilds:
I hate leaving assignments undone, does anyone have a workaround? 🐞
This works for me for today: 21-08-2018 No Bugs for: template strings were used const resultDisplayArray = arr.map(err =>
<li class="text-warning">${err}</li>
);