Tweet Undefined

Tweet Undefined
0

#1
$(document).ready(function() {
  var randomQuote;
  var randNum;
  var author;
  var output;
  
  function getQuote() {
  //create array of quotes
    var quotes = ["We've done the impossible, and that makes us mighty.", "Did something just fly off my gorram ship?", " We're not gonna die. We can't die, Bendis. You know why? Because we are so very pretty. We are just too pretty for God to let us die."]
    var author = ["- Mal", "- Malcolm", "- Malcolm R."]
    //generator random num
  randNum = Math.floor((Math.random()*quotes.length));
  //generate randauote randauthor
  var randQuote = quotes[randNum];
  var randAuthor = author[randNum];
  
  var qouteAuthor = randQuote + "  " + randAuthor;
  $(".quote").text(randQuote);
  $(".author").text(randAuthor);
  return qouteAuthor;   
}
//tweet button
  $('#tweet').on("click", function() {
    window.open("https://twitter.com/intent/tweet?text=" + output);
  });
  //quote button
 $('#newQuote').on("click", function(){
  getQuote();
});   
});

#2

can you provide a link to your pen??


#3

https://codepen.io/Wynterwolf/pen/LOWmEB


#4

The problem is that you have only declared the output variable but not assigned anything to it therefore its value is undefined.

You need to assign the last random quote to the output varaible.