JavaScript Complete Course: final quiz

Fifteen questions covering the whole JavaScript Complete Course.

  • Beginner
  • 15 questions

15 questions. Pass mark 70%.

  1. Question 1 of 15 What does this code log?
    JavaScript
    const scores = [10, 20];
    scores.push(30);
    console.log(scores.length);
  2. Question 2 of 15 What does typeof null return?
  3. Question 3 of 15 Which of these expressions evaluate to true?

    Select all that apply.

  4. Question 4 of 15 Why does 0.1 + 0.2 === 0.3 evaluate to false?
  5. Question 5 of 15 What does this loop log?
    JavaScript
    const letters = ["a", "b"];
    for (const i in letters) {
      console.log(typeof i);
    }
  6. Question 6 of 15 Which statement about arrow functions is true?
  7. Question 7 of 15 What does this code log?
    JavaScript
    function makeCounter() {
      let count = 0;
      return () => ++count;
    }
    
    const a = makeCounter();
    const b = makeCounter();
    a();
    a();
    console.log(a(), b());
  8. Question 8 of 15 What is the value of result?
    JavaScript
    const result = [1, 2, 3, 4]
      .filter((n) => n % 2 === 0)
      .map((n) => n * 10);
  9. Question 9 of 15 What does this code log?
    JavaScript
    const volume = 0;
    console.log(volume || 50, volume ?? 50);
  10. Question 10 of 15 You need to show a name that a visitor typed into a form inside a paragraph. What should you use?
  11. Question 11 of 15 In what order are the letters logged?
    JavaScript
    console.log("A");
    setTimeout(() => console.log("B"), 0);
    Promise.resolve().then(() => console.log("C"));
    console.log("D");
  12. Question 12 of 15 getUser() and getCourses() both return promises and do not depend on each other. Which code inside an async function starts both at once and waits for both?
  13. Question 13 of 15 A fetch() request gets a 404 Not Found response. What happens?
  14. Question 14 of 15 What does this code log?
    JavaScript
    const original = { tags: ["js"] };
    const copy = { ...original };
    copy.tags.push("css");
    console.log(original.tags.length);
  15. Question 15 of 15 You load three independent reports and want every result, even if one of the requests fails. Which method fits?