MCQs > IT & Programming > JavaScript > Assume that the header has the following code snippet: What's wrong with this code snippet?

JavaScript MCQs

Assume that the header has the following code snippet:

<script>
   var a = document.getElementById("id1");
   alert(a);
</script>

What's wrong with this code snippet?

Answer

Correct Answer: At the time this code snippet is executed, the element with id1 does not exist.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it