Question:Which of the following code snippets is more efficient and why?
<script language="JavaScript"> for(i=0;i<document.images.length;i++) document.images[i].src="blank.gif"; </script> <script language="JavaScript"> var theimages = document.images; for(i=0;i<theimages.length;i++) theimages[i].src="blank.gif" </script>
A Both are equally efficient
B The first code is more efficient as it contains less code
C The first code is more efficient as it employs object caching
D The second code is more efficient as it employs object caching
+ AnswerD
+ Report