Nice project! Thank Codecademy and All the staff.
The project isn’t specially difficult. Took me a couple of hours finish him. But I have programming background in other languages.
My repo: GitHub - cloudofuniverse/mixedMessagesProject
Deployed project: https://fortunereader.herokuapp.com/
Hope you like it!
Very nice and well done! I’m not expert but while doing this, I found 2 cool things.
2 things I came across in my research that you might be interested in knowing is:
- When you press the button, you have to refresh the webpage for the button to reset. Well, what I found as a workaround is to use:
setTimeout(() => {window.location.reload()}, 3000);
where 3000milliseconds = 3 seconds
and you can place that somewhere within:
function toHTML() {
document.getElementById("fortuneText").innerHTML = formatFortune();
}
This will reload the page after 3 seconds. For example, the code I used in mine was:
document.getElementById("buttonClick").onclick = function() {
document.getElementById("displayHere").innerHTML = displayCourse(fullCourse);
document.getElementById("reloadMessage").innerHTML = 'Reloading Page in 3...2...1...';
setTimeout(() => {window.location.reload()}, 3000);
}
- The second cool thing I figured out was the printing of a new line between each sentence. So I was wondering why ‘\n’ wouldn’t work for new line in my javascript code. Then, I came across the answer. Use “
” in your javascript code if you want to seperate the lines when printed.
2 Likes