I recently revisited the pagewhich has on it "The Ultimate getElementsByClassName" and there is an updated version of this function there which has default arguments. I tested this new version and it worked just fine, however I did not understand how the default arguments worked in the code. And I do not know how to search for a reference on the Web for the lines I do not understand. So I would appreciate it if you could point me to a reference which explains the lines I have mocked in Orange in the code I am posting below.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>get class</title>
<script type="text/javascript" charset="utf-8">
function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");

	var tag = tag || "*";
	var elm = elm || document;

	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
	return returnElements;

var  arrRedClass=getElementsByClassName("redClass");	 
var a = arrRedClass[0];
var b = arrRedClass[1]; 
<p class="redClass">red </p>
<p>no red</p>
<p class="redClass">red </p>
<p>no red</p>