I'm very new to Javascript and programming all together. I've been trying to get this Javascript code to run on my website and I just can't get it to work.
var yourName = prompt("What is your name?");
if(yourName.length < 10) {
confirm("Your name is less than 10 letters long!");
}
else {
confirm("Your name is more than 10 letters long!");
}
I've tried saving this as a .js
file and uploading it to the public_html
folder with FileZilla and adding
<script src="script.js"></script>
to my index HTML file.
Can someone tell me what I'm doing wrong?