标签:return log function 函数 fun 分析 on() str ons
1.
var a = 12
function fn() {
console.log(a)
var a = 45;
console.log(a)
}
fn()
2.
function fn() {
console.log(11)
function ff() {
console.log(22)
}
ff()
}
fn()
3.
function fn() {
console.log(5) fn()
}
fn()
4.
var a = 123;
function fun() {
alert(a);
}
fun();
5.
var a = 123;
function fun() {
alert(a);
var a = 456;
}
fun();
alert(a);
6.
var a = 123;
function fun(a) {
alert(a);
a = 456;
}
fun();
alert(a);
7.
var a = 123;
function fun(a) {
alert(a);
a = 456;
}
fun(123);
alert(a);
8.
function test(a, b) {
console.log(a);
console.log(b);
var b = 234;
console.log(b);
a = 123;
console.log(a);
function a() {}
var a;
b = 234;
var b = function() {}
console.log(a);
console.log(b);
}
test(1);
9.
function fn(a) {
console.log(a);
var a = 123;
console.log(a);
function a() {}
console.log(a);
var b = function() {}
console.log(b);
function d() {}
}
fn(1);
10.
function fn() {
console.log(12)
}
var as = fn() console.log(as) 11.
function fn() {
console.log(12) return 45;
console.log(456)
}
12.
var a = 12;
function fn() {
console.log(a) return 4;
var a = 45;
}
13.
var a = 100;
function testResult() {
var b = 2 * a
var a = 200
var c = a / 2 alert(b) alert(c)
}
testResult()
标签:return log function 函数 fun 分析 on() str ons
原文地址:https://www.cnblogs.com/zzz035921/p/10055007.html