We have been using function in the example in the previous chapters. I will just play with functions in here.
=================
let globalVariable = "Global Variable: ";
function iWillTakeGlobal(talk){
document.write('${globalVariable} ${talk}');
}
function iHaveMyOwnLocal(talk){
let localVariable = "Local Variable: ";
document.write('${localVariable} ${talk}');
}
function iAmAParameter(talk,){
document.write('${parameterVariable} ${talk}');
}
function helloReturn(){
return "Why are you not using me?";
}
function myFunctionalStory(){
iWillTakeGlobal("Anyone can call me! ");
iHaveMyOwnLocal("Oh! That is not my case. I am exclusive within this function wall. ");
iAmAParameter("Your local? I am too. And I can have default values. ");
document.write(helloReturn());
}
=================
HTML
document.write(myFunctionalStory())
Result:
Global Variable: Anyone can call me! Local Variable: Oh! That is not my case. I am exclusive within this function wall. Parameter Variable: Your local? I am too. And I can have default values. Why are you not using me?undefined
Note: The result should be a long line of text.
YOU ARE READING
Javascript Programming
RandomI am just documenting things what i learned online in here. I do express things in my own words. And I create my own program samples which serves as my practice. I do this so that when someday I would need some notes to review, I can just visit in h...
