Random quote rotator On my website, I created like this banner that rotates quotes from an array I made. 

var myarray = []
myarray[0] = "\"To a contrarian like me, constant advice not to do something almost always starts me quickly down the risky, unpopular path.\" &lt;br&gt; &lt;strong&gt; Micheal Bloomberg.&lt;/strong&gt;"; 
myarray[1] = "\"In investing, what is comfortable is rarely profitable.\" &lt;br&gt;&lt;strong&gt; Robert Arnott&lt;/strong&gt;"; 
myarray[2] = "\"Know what you own, and know why you own it.\" &lt;br&gt;&lt;strong&gt; Peter Lynch&lt;/strong&gt;";
myarray[3] = "\"Buy when everyone else is selling and hold until everyone else is buying. That’s not just a catchy slogan. It’s the very essence of successful investing.\"  &lt;br&gt;&lt;strong&gt; J. Paul Getty&lt;/strong&gt;";
myarray[4] = "\"When something is important enough, you do it even if the odds are not in your favor.\" &lt;br&gt;&lt;strong&gt; Elon Musk&lt;/strong&gt;";
myarray[5] = "\"I will tell you the secret to getting rich on Wall Street. You try to be greedy when others are fearful. And you try to be fearful when others are greedy.\" &lt;br&gt;&lt;strong&gt; Warren Buffet&lt;/strong&gt;";
myarray[6] = "\"Innovation distinguishes between a leader and a follower.\" &lt;br&gt; &lt;strong&gt;Steve Jobs&lt;/strong&gt;";
myarray[7] = "\"The only thing that makes sense is to strive for greater collective enlightenment.\" &lt;br&gt;&lt;strong&gt; Elon Musk&lt;/strong&gt;"
myarray[8] = "\"The single best piece of advice: Constantly think about how you could be doing things better and questioning yourself.\"&lt;br&gt;&lt;strong&gt; Elon Musk &lt;/strong&gt;"
//Quote randomizer I made.

function quote() {
    var x = Math.floor(Math.random() * (myarray.length));
    document.getElementById("quotes").innerHTML = myarray[x];

}

var myVar = setInterval(quote, 15000);


Is there a better way to write this code? I wrote it back in February of this year. Now, I am just curious if there is any way to improve it.

For those who want to see it in action, scroll down past the "meet the team" section after you click here.
Cache DOM selectors

You select the target container over and over again. You should get it once outside the function, cache it in a variable and reuse it:

const target = document.getElementById('quotes');


Naming

Try to use descriptive names instead of myarray, myVar and quote:

const quotes = [];
function changeQuoteRandomly() {}


Style

It's easier to read, if you use single quotes on the strings, as you don't have to escape the double quotes:

quotes.push('"Important words" by Someone');


You sometimes use a semicolon at the end of the line and sometimes you don't – use only one way and be consistent:


var myarray = []
var myVar = setInterval(quote, 15000);



I would prefer using push to add elements to the array instead of setting the index manually. Or you could even add all elements during initialization:

const quotes = [
    '"Important words" by Someone',
    '"Other important words" by Someone'
];


Both ways make it easier to re-arrange elements later as you don't have to keep track of the index yourself.

Semantics

Currently your markup looks like this:


&lt;div id="quotes"&gt;
    "The single best piece of advice: Constantly think about how you could be doing things better and questioning yourself."&lt;br&gt;
    &lt;strong&gt; Elon Musk&lt;/strong&gt;
&lt;/div&gt;



You could improve this, by using blockquote, cite and even figure elements. Here you can find more infos and examples on W3C: 4.4.5. The blockquote element.

User experience

While this is a nice addition on your website, there are a few downsides:


There's no introduction to this section, the visitor has no clue why you're showing them. Try to relate them to your business.
The first quote is shown after 15s, until then only an empty blue container ist visible.
15s between quotes is a really long time. There's no indicator that more is coming, so there's a great chance that a user will not see a second one.