HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

script.js line break in a variable quotes = [" (no solution)

Hi. (I'm not familiar with the forums)

I'm really a beginner (and old ha ha ha)
I found some programming that allows me to display random sentences from HTML. The code is fine after some reflections and adaptations I am trying to make a line BREAK in a variable so that the name of the creator of the quote is after the sentence, below.

Q1) For example and simplified, a sentence:
"So shaken as we are, so wan with care," Henry announces to his court. Shakespeare"
I would like this:
"So shaken as we are, so wan with care, Henry announces to his court." (on line return...)
"Shakespeare"

script.js line break in a variable quotes = [" (no solution)

I can't find...
The code used (which I did not create comes from a codePen site. The script.js gives this and works (in short) but not possible to find a line break

var quotes = ["So shaken as we are, so wan with care," Henry announces to his court. Shakespeare",

"To be, or not to be: that is the question. Shakespeare"
]; etc. etc.

function getQuote() {
var randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
document.getElementById("parag").innerHTML="<em>" + randomQuote + "</em>";
}

Q2) How to add a new image on new quote

Comments

Sign In or Register to comment.