This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Frage zu Übergabeparametern
#1
Guten Tag,
ich habe Probleme folgendes Scriot zu verstehen.
Die Frage lautet: Welche Werte haben die Variblen g und h am Ende.
Unten wird die Funktion umwand_2 mit Übergabe von h aufgerufen.
Wird dann innerhalb der Funktion par mit h erstezt? Oder wie läuft das ab.
Und wenn ja wieso hat h="ist egal" keine Auswirkung auf par=par+"ist heute schlecht";



<script type="text/javascript"> //<![CDATA[
var g, h = "Wetter";
function umwand_2(par)
{
h="ist egal";
par = par+"ist heute schlecht";
return par;
}
g=umwand_2(h);

//]]>

</script>
Zitieren
#2
Moin.
Du gibts das h ja hier mit
umwand_2(h)
hier wird h zu par
umwand_2(par)
hie wird par zu par plus text dazu ( par = "Wetter ist heute schlecht" )
dann wird hier der ganze Satz zurüch kekeben
return par;

in der function wird h="ist egal" , nie gebraucht , oder abgefragt .( wenn h nicht zu par geworden wäre, dann wäre es anders )

An ende
g=umwand_2(h);
gibt g auch das raus was par ist

Ich hoffe da verstehst mein Gekritzel, weil erklären ist nicht meine Stärke
Als Lösung markieren Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste