JSFiddle - React, Tailwind, and code Playground

JavaScript

function findSecretMessage(paragraph) {
  arr = paragraph.split(' ');

	arr = arr.map(word=>{
  	word = word.toLowerCase();
    if(word.match(/\./) != null){
      word = word.slice(0, -1);
    }
    return word
  })
  
  console.log(arr)
}

var paragraph = 'This is a test. this test is fun.';
findSecretMessage(paragraph);