16 lines
373 B
JavaScript
16 lines
373 B
JavaScript
import Searcher from './Searcher';
|
|
|
|
const search = new Searcher();
|
|
const questionObj = {
|
|
question: 'What is the question?',
|
|
answers: [
|
|
{ text: 'Yes' },
|
|
{ text: 'No' },
|
|
{ text: 'Maybe' },
|
|
],
|
|
};
|
|
search.search(questionObj, (answer) => {
|
|
const suggestedPick = answer.indexOf(Math.max(...answer));
|
|
console.log(questionObj.answers[suggestedPick].text);
|
|
});
|