predict your doom’s day using my web app DEATH PREDICTOR
let me know what did you get.
me?
it says i am gonna live to an age of 83.
Fun quiz! If a little morbid… I got 73
At the moment, all your data (the choices and their corresponding modifiers) is stored in attributes in your HTML. Instead, consider creating the UI dynamically from the data. Pseudocode example:
questions = [{question: 'What continent do you live on?', answers: [{name: 'Europe', val: 77}, ...]}, ...];
//create the UI
//increment/decrement score on user input and show the next question
//then display final score to user after all questions answered
am new to javascript, i would be really glad if anyone can tell me how? because in each function i got the elements by ids, i tried ways to use the id’s in some sequence so that i do not have to write it again and again but it did not work, but still, i will definately make changes soon, thank you!!!
@lionel-rowe i am new to js and was troubled getting values out of onclick function, it would be great if you can show how do i get the value out of arrey when the button is clicked
@camperextraordinaire Thank you very much sir, you enlightned me here, i had to search various places for javascript that i needed to get my idea into reality, i had no idea something like parentNode and nextElementSibling could be used.
But i will keep further doubts to myself for now and will start the javascript challanges as soon a i have completed the responsive web dev projects, DO you have any other suggestion besides freecodecamp, perhaps a book or something like that so that i can get a clear and better understanding of javascript?
thanks again, and can i use the code you have provided?
if i can, how do i mention you?