Only just started learning JavaScript.
Why won't my button display the values in my "authors" array?
/* JavaScript file */
var authors = ['Ernest Hemingway', 'Charlotte Bronte',
'Dante Alighieri', 'Emily Dickinson'
];
function ShowAuthors(authors) {
for (i = 0; i <= authors.length; i++) {
document.write(authors[i]);
}
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="./js/script.js"></script>
<link rel="stylesheet" href="./css/style.css" />
</head>
<body>
<div class="container">
<input type="button" class="author" value="Show Authors" onClick="ShowAuthors()" />
</div><br>
</body>
</html>
Sorry for the terrible formatting, I'm new here. I'm probably missing something super basic..
authorsinonClick.scope of variablesandshadowing