Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Arrays Multidimensional Arrays Build a Quiz Challenge – One Solution

Alex Francis
Alex Francis
14,248 Points

My solution

const questions = [
    'Which method adds an element to the end of an array?', 
    'Which method adds an element to the start of an array?',
    'Which method determines whether an array includes a certain value among its entries, returning true or false?',

function makeOL(arr) {
  let html = '<ol>';
  for (let i = 0; i < arr.length; i++) {
    html += `<li>${arr[i][0]}</li>`;
  return html += '</ol>';

let score = 0;
const wrongAnswers = [];
const correctAnswers = [];

for (let i = 0; i < questions.length; i++) {
  if (prompt(questions[i][0]) === questions[i][1]) {
  } else {

document.querySelector('main').innerHTML = `<h1>You got ${score} correct anwsers!</h1>
                                            <h2>You got these questions right:</h2>
                                            <h2>You got these questions wrong:</h2>

Seems to work, and I made a cheeky function, too.