I think one of my biggest problems in javascript is the way I write what I do and I need a push if someone can why this happens to me:
I'm getting the following error:
Reference error: simplefor is not defined
The only thing I can think of is to do window.simplefor = function()
, but I do not want to do it, I like to understand why I do this and really understand how it works , it is worth noting that I research a lot, I see videos, books and more.
// Simple for loop 1 - 10
function simplefor() {
var i = 0;
for (i; i < 10; i++) {
document.write(i + '\n')
}
}
<h1 style="text-align: center">Learning Javascript</h1>
<hr></hr>
<h5 style="text-align: center">Simple for 1 - 10 </h5>
<script>
simplefor()
</script>
<hr/>