Get all child elements of body, why not write like this?

  node.js, question
<script type="text/javascript">
 countBodyChildren() {
 var body_element = document.getElementsByTagName("body")[0];
 alert(body_element.childNodes.length);
 bracket
 window.onload = countBodyChildren;
 </script>

Sys/wait.h’s statement is wrong, how can you do that?

var countBodyChildren = function() {
 var body_element = document.getElementsByTagName("body")[0];
 alert(body_element.childNodes.length);   };