Baidu front-end interview questions

Multiple choice

  1. Which module in node is used to create the web server?
    http module
  2. In the node.js application, (var http = require('http')) can obtain the http module correctly
  3. Which JavaScript library does not support the Promise specification?
    The underscore
    JavaScript library supports the Promise specification:
    co
    bluebird
    Q(Q.js)
  4. What does the following JavaScript program output
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);

The answer is: true, true, false

  1. The following code output structure is
var foo =1;
function baidu(){
    
    
	console.log(foo);
	var foo=2;
	console.log(foo);
}
baidu();

Answer: undefined 2

Guess you like

Origin blog.csdn.net/weixin_50001396/article/details/113839146