函数分析题
Posted zzz035921
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了函数分析题相关的知识,希望对你有一定的参考价值。
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()
以上是关于函数分析题的主要内容,如果未能解决你的问题,请参考以下文章