Message from JavaScript discussions
December 2018
— The names are only from the sample, so as not to put the names of the variables.
Hey guys I am getting an error in on my console saying: Uncaught TypeError: Cannot set property 'classname' of null at setThemefromCookie (script.js:286)
at script.js:290
at script.js:291
Here's a screenshot of the script being referred.
— Https://developer.mozilla.org/en-US/docs/Web/API/Element/id
— Https://developer.mozilla.org/en-US/docs/Web/API/Document/body
— Https://youtu.be/cuJhTfq1-dc
— Guys, can i use flatMap in an async way? arr.flatmap(async value => {return 'hi, im elfo'})
— Doesn't make sense
— FlatMap expects an array from the callback
— But you could, with some wrapping
—
const flatMapP = (f, arr) =>
Pomise.all(
arr.map(f))
.then(res =>
res.reduce((a, b) =>
a.concat(b), []));
—
flatMapP(
async val => [ 'elfo' ],
arr);
— Thanks, i did a bit sepration, now and have to force the async flatmapping, its cleaner that way