基本function框架
function a() {
alert('a');
}
a(); // call a function. show a
function b(input) {
alert('b:'+input);
}
b("123"); // call b function. show b:123
function c() {
alert('c');
return "result";
}
var returnC = c(); // call c function. show c
function d(input) {
alert('d:' + input);
return input;
}
var returnD=d("input"); // call d function. show d:input
function A1(input) {
function B1() {
return 'B1:'+input;
}
alert(B1()); // call B1 function
}
A1('input'); // call A1 function. show B1:input
try {
B1(); // undefined exception
}
catch (e) { alert(e) };
if (typeof (customFunction) == 'function') {
customFunction();
}
沒有留言:
張貼留言