explanation for JS functions