Passing variables into a function
<script>function addNumbers(a,b){
var c = a+b;
return c;
}
document.write(addNumbers(3,9));
</script>
Use a function to call another function
<script>function executeFirst() {
document.write("Please don't kill me, I'm too young to die.<br>")
}
function executeSecond() {
document.write("I'm ready to die.")
}
function execute() {
executeFirst();
executeSecond();
}
execute();
</script>
No comments:
Post a Comment