I mean like even if you misspell Pikachi it auto corrects to Pikachu because its the most closely related
For example
let array = ["Pikachu","Rawrr","Squirtle]
let string = "Pikachi"
function(string) // will return "Pikachu"
In my case, I gave the string Pikachi and it was most related to Pikachu and it does not match any string in the array so it chose that. How can I do this in javascript?