首页 > 代码库 > 这道js面试题号称99%的人会做错

这道js面试题号称99%的人会做错

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="http://www.mamicode.com/app/js/jquery-2.1.4.js"></script>
		<script type="text/javascript">
			$(function() {
				var a=11;
				function aaa(a) {
					console.log(a);
					a=10; 
				}

				function bbb(a) {
					console.log(a);
					a=100;
				}

				function ccc(a) {
					console.log(a);
					a=1000;
				}
				
	            //
	            	
				var arry = [];
				arry.push(aaa);
				arry.push(bbb);
				arry.push(ccc);
				for(var i = 0; i < arry.length; i++) {
					arry[i](a);
				}
				
				//var sb = $.Callbacks().add(aaa).add(bbb).add(ccc).fire();
				var sb = $.Callbacks().add(aaa, bbb ,ccc).fire(a);
	 
			})
		</script>
	</head>

	<body>
	</body>

</html>

  技术分享

这道js面试题号称99%的人会做错