Skip to content

Commit

Permalink
add: Added 3 new questions to the JavaScript quiz (#975)
Browse files Browse the repository at this point in the history
* add: Added 3 new questions to the JavaScript quiz

* Updated questions, answers, and explanations in JavaScript quiz, including rephrased questions and updated links to MDN documentation.
  • Loading branch information
ijayhub authored Jul 1, 2024
1 parent 270fa66 commit f1e3d1e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/data/javascript-quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,38 @@ const javascriptQuiz = [
Explanation:
"Variable names cannot start with a number or any special character.",
Link: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types"
},
{
Question:
"In JavaScript, what would happen if you tried to reassign a value to a const variable?",
Answer: "JavaScript throws a TypeError",
Distractor1: "JavaScript throws a SyntaxError",
Distractor2: "The JavaScript program will crash",
Distractor3: "The program will return null",
Explanation:
"In JavaScript, a type error will occur because a variable declared with const cannot be reassigned.",
Link: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const"
},
{
Question:
"In JavaScript, what would be the result for the following: 0.1 + 0.2 === 0.3?",
Answer: "false",
Distractor1: "true",
Distractor2: "undefined",
Distractor3: "NaN",
Explanation:
"Due to floating-point precision issues, 0.1 + 0.2 does not exactly equal 0.3.",
Link: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON"
},
{
Question: "What does Array.isArray([]) return?",
Answer: "true",
Distractor1: "false",
Distractor2: "undefined",
Distractor3: "null",
Explanation:
"Array.isArray([]) returns true because the isArray method checks if the passed argument is an array.",
Link: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray"
}
];

Expand Down

0 comments on commit f1e3d1e

Please sign in to comment.