I really need help. And I hope somebody is there for me. I was asked to write a fiunction that takes an array of names with some of them beind misspelled. I had to find all the misspelled names and to correct them. Since I had more than 50 names I felt utile to use a doctionnary online. Here is the extension I need to fix the case.:“spellchecker” I already got it in my telephone and my computer as you can see in the left part of the picture that I posted here. But in both devises it does not work Help me please!
Capture d’écr|690x402
Try using ES Modules instead of CommonJS requires:
import * as dictionary from "spellchecker";
or
import { isMisspelled } from "spellchecker";
Hi hankertrix,
Thanks for reacting to my request. But I should tell you that I do not catch what you are suggesting me to do here. Where am I supposed to write this
import { isMisspelled } from “spellchecker”;
or
import * as dictionary from “spellchecker”;
Is it in the text of the code that I wrote or it is in a different place. Can you add a picture of where I can do that? I really need help.
But once again I say thanks for all.
Just replace line 28 with that line. So
const dictionary = require("spellchecker")
becomes
import { isMisspelled } from "spellchecker";
And then you can replace dictionary.isMisspelled
with just isMisspelled
.
Hi Qwerty or any other name you may have. But I really tried what you are suggesting here. I wrote
import { isMisspelled } from "spellchecker";
const wrongNam = names.filter(item => isMisspelled(item));
console.log(wrongNam);
Then I pressed the run button and in the console I got this message.
/home/runner/Exercises-of-array-functionsj s/index.js:28
import { isMisspelled } from "spellchecker";
SyntaxError: Cannot use import statement o utside a module
Hint: hit control+c anytime to enter REPL.
It is an error message suggesting that what I try to do using ES6 in a JS module does not work. So I still need help.