1D0-720 · Question #52
Which is a common type of error in JavaScript?
The correct answer is D. All of the above. All three options are common JavaScript error types, making D the correct choice. A syntax error occurs when code violates the language's grammatical rules (e.g., a missing closing bracket), preventing the script from parsing at all. A runtime error occurs during execution when…
Question
Which is a common type of error in JavaScript?
Options
- ASyntax error
- BLogic error
- CRuntime error
- DAll of the above
How the community answered
(38 responses)- B3% (1)
- C3% (1)
- D95% (36)
Explanation
All three options are common JavaScript error types, making D the correct choice. A syntax error occurs when code violates the language's grammatical rules (e.g., a missing closing bracket), preventing the script from parsing at all. A runtime error occurs during execution when an operation is impossible (e.g., calling a method on undefined), causing the script to crash mid-run. A logic error is the subtlest - the code runs without crashing but produces the wrong result due to flawed reasoning (e.g., using = instead of === in a condition).
The distractors A, B, and C aren't wrong - they're all correct on their own, which is exactly why D supersedes them. "All of the above" questions often signal that each individual option is valid.
Memory tip: Think SRL - Syntax (won't start), Runtime (crashes mid-run), Logic (wrong answer) - every JavaScript program can fail at any of these three stages.
Topics
Community Discussion
No community discussion yet for this question.