JSFiddle - React, Tailwind, and code Playground

HTML

<input id="ask-bar"/>
<button id="check-mood">Check</button>
<div id="result"></div>

JavaScript

var moodList = {
  sad: [
      '"Dream as if you\'ll live forever, live as if you\'ll die today." James Dean',
      '"Life is a journey, and if you fall in love with the journey, you will be in love forever." Peter Hagerty',
      '"I\'ve learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel." Maya Angelou'
  ],
  angry: [
      '"For every minute you remain angry, you give up sixty seconds of peace of mind."Ralph Waldo Emerson',
      '"Speak when you are angry - and you\'ll make the best speech you\'ll ever regret." Laurence J. Peter',
      '"Anger and intolerance are the enemies of correct understanding."Mahatma Gandhi'
  ]
};

var askBar = document.getElementById("ask-bar");
var resultEl = document.getElementById("result");
var buttonEl = document.getElementById("check-mood");

buttonEl.onclick = function checkMood(){
  
  var askBarValue = askBar.value;
	var hasMoodOnFile = false;
  for (let key in moodList) {
          const moodFeeling = key;

          var    motivQuoteResult = [];
          if (askBar.value.includes(moodFeeling)) {
		          motivQuoteResult = moodList[moodFeeling];
              var randomResult = Math.floor(Math.random() * motivQuoteResult.length);
              result.innerHTML = motivQuoteResult[randomResult];
              hasMoodOnFile = true;
          } 
  }
  if(!hasMoodOnFile){
		  result.innerHTML = '<h3>Try again, I don\'t have that feeling on file</h3>';
  }
};