Why does this code check whether 'oneHref' is true or not in the beginning of the 'if' statement? I took it out and the code still preformed its function (to add an <img> to external links on page load.) So, if it still works why should it be there?

<script type="text/javascript">
			function externalLinks() {
				var allLinks = document.getElementsByTagName("a");
				var icon = document.createElement("img");
				icon.setAttribute("src", "external.png");
				icon.setAttribute("alt", "[external link]");
				for (var i = 0; i < allLinks.length; i++) {
					var oneHref = allLinks[i].getAttribute("href");
                                        // here, right before the '&&'
					if (oneHref && oneHref.indexOf("http") == 0) {
						var newImg = icon.cloneNode(true);
			window.onload = externalLinks;
(code taken directly from Designing with Web Standards, 3rd Edition. Jeffrey Zeldman)