JavaScript: From First Steps to Professional

Quiz Project Functions Exercise

Anjana Vakil

Anjana Vakil

Software Engineer & Educator
JavaScript: From First Steps to Professional

Check out a free preview of the full JavaScript: From First Steps to Professional course

The "Quiz Project Functions Exercise" Lesson is part of the full, JavaScript: From First Steps to Professional course featured in this preview video. Here's what you'd learn in this lesson:

Anjana provides an exercise to practice declaring functions in the JavaScript quiz project. Students are instructed to declare functions that disable or enable a button and declare an isCorrect(guess) function that compares the given string to the previously created fact's answer string.

Preview
Close

Transcript from the "Quiz Project Functions Exercise" Lesson

[00:00:00]
>> So let us now go back to our quiz document. Yeah, and in the next TODOs, TODOs four and five we have some comments asking us to declare a couple of functions. So these are gonna ask us to do something that maybe we haven't tried doing before, which is to disable or enable a button element.

[00:00:30]
And button elements in HTML have an attribute that can have an attribute called disabled, which if it is set disables the button. And then we're also going to declare a function called isCorrect, which is gonna take in a guess string. And it's going to compare that to the correct answer which you declared in your fact object and it's going to tell us whether that guess is the correct answer.

[00:01:04]
Cool, so these are the functions that we're gonna write in our quiz HTML document. This is kind of a tricky one because I teed you up for something new that we haven't talked about before. But this is because I have such confidence in your investigative powers of figuring out how to do new stuff with for example the help of our friend MDN perhaps.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now