Files
tasJS/SearchTest.js
2018-07-10 16:51:22 -04:00

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);
});