百度 前端 面试题

单选题

  1. node 中的哪个模块被用来创建 web server?
    http 模块
  2. 在node.js应用中,(var http = require(‘http’)) 可以正确获取http模块
  3. 哪个JavaScript 库不支持 Promise规范?
    underscore
    JavaScript 库支持 Promise规范的有:
    co
    bluebird
    Q(Q.js)
  4. 以下 JavaScript程序输出什么
var x ="undefined";
var y = "false";
var z = "";
function assert (xVar){
    
    
	if (xVar)
		console.log(true);
	else
		console.log(false);
	}
assert(x);
assert(y);
assert(z);

答案为: true , true, false

  1. 下面的代码输出结构为
var foo =1;
function baidu(){
    
    
	console.log(foo);
	var foo=2;
	console.log(foo);
}
baidu();

答案:undefined 2

猜你喜欢

转载自blog.csdn.net/weixin_50001396/article/details/113839146