Buscador de oraciones II

Crea una función que devuelva la oración que contiene la palabra en el índice n. Recuerda incluir el punto final.

Ejemplo resuelto

const txt = "I have a dog. I have a log. There is no stopping me now."

sentenceSearcher(txt, 7) ➞ "I have a log."
// The word at index 7 is "log".
// The full sentence that contains the word at index 7 is "I have a log."
// Return the sentence.

Ejemplos

sentenceSearcher(txt, 2) ➞ "I have a dog."

sentenceSearcher(txt, 4) ➞ "I have a log."

sentenceSearcher(txt, -1) ➞ "There is no stopping me now."
// The index at -1 is the last word.
// The last word is "now".

Notas

  • Todas las oraciones terminarán con un punto final.
  • También debes tener en cuenta los índices negativos.