Develop a Quiz App with Javascript - Object Oriented Programming
Why Stack Overflow recommends it
Stack Overflow users link it as the source tutorial their quiz app code came from, usually when asking for help debugging problems such as undefined objects, null elements and question randomisation.
Recommended by 1 people across 1 different months, 2017 to 2020.
What it is
A 45-minute JavaScript tutorial by Awais Mirza that builds a complete quiz web app using object oriented programming. It covers designing models and controllers for the app's features and building the interface with HTML and CSS.
What people said
Recommends Default42 · 2018-08 · Stack Overflow · on “How to debug JavaScript object issues?”
I am going through this JavaScript tutorial [this video] and ran into an issue that I hope someone can assist me with. After selecting the last question on the quiz, my showScore() function displays the results as "undefined". Through some further debugging, I found that it was a problem with my quiz object. In my PopulateQuestion() function, I am able to print out the quiz object before executing the showScore() function. However, when I attempt to print out the quiz object from within the showScore() function, it returns undefined. I would like to work on my ability to debug issues that come up like this. Based on debugging that I have done so far, my educated guess is that this is a scope issu
Cites Miki · 2017-02 · Stack Overflow · on “why script tag with javascript doesn't work in ionic project?”
I am developing a quiz part of my project based on this [this video] tutorial. However, I have tried placing the script tags containing javascript files just before closing the body tag, but it doesn't read the javascript files at all. I have also tried running javascript code inside the script tags but same result. It works fine when i run the code outside the ionic project by creating a separate javascript project. Do i have to specify somewhere that i'm using .js files in the project instead of .ts? How should i run a javascript code inside my ionic project? Any help will be appreciated, Thank you! <!DOCTYPE html> <html lang="en"> <ion-header> <ion-navbar color="primary"> <ion-title>Quiz</ion-
Cites James Anthony · 2019-07 · Stack Overflow · on “uncaught TypeError: cannot set property "innerHTML" of null at populate (app.js:13) at app.js:55”
uncaught TypeError: cannot set property "innerHTML" of null at populate (app.js:13) at app.js:55 I entered this code watching a video on youtube from beginning to end: [this video] heres a link to my repo with everything you'll need to copy, paste, run to see what im facing right now: function populate() { if(quiz.isEnded()) { //show scores// } else { // show question var element = $("#question"); element.innerHTML = quiz.getQuestionIndex().text; // show choices var choices = quiz.getQuestionIndex().choices; for (var i = 0; i < choices.length; i++) { var elementChoice = document.getElementById("choices" + i); elementChoice.innerHTML = choices[i]; } showProgress(); } } function guess(id, guess) {
Cites loadmasterbob · 2020-01 · Stack Overflow · on “How to Fisher-Yates shuffle a JavaScript array?”
I'm trying to modify this quiz app from a tutorial from Awais Mirza [this video] I would like to pick a random selection of questions from a master array and push it in to a selection array the script uses to populate questions, so the quiz will give a random set of questions form the master array every time the quiz is run. I thought i could use Fisher-Yates shuffle to randomize the master array before pushing the selected number of questions into a selection array. Why does the Fisher-Yates shuffle work with this array; var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; var i = arr.length, j, temp; while(--i > 0){ j = Math.floor(Math.random()*(i+1)); temp = arr[j]; arr[j] = arr[i];
Cites GISK · 2020-01 · Stack Overflow · on “create arrays containing questions, answers and the right answer”
it is not possible to add such a long code however, i posted a link with the same code here you have a link with almost identical code: [this video]