欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

JavaScript 好题汇总分享(持续更新,看到好题就写)

程序员文章站 2022-06-21 23:33:11
前言本文搜集的题目,均来自各大网课、面试题等预编译相关1a = 100;function demo(e) {function e() { }arguments[0] = 2;console.log(e);if(a){var b = 123;function c() {}}var c;a = 10;var a;console.log(b);f = 123;console.log(c);console.log(a);}var a;...

前言

本文搜集的题目,均来自各大网课、面试题等

预编译相关

1

a = 100;
function demo(e) {
	function e() {  }
	arguments[0] = 2;
	console.log(e);
	if(a){
		var b = 123;
		function c() {
		}
	}
	var c;
	a = 10;
	var a;
	console.log(b);
	f = 123;
	console.log(c);
	console.log(a);
}
var a;
demo(1);
console.log(a);
console.log(f);

2

function bar(){
	return foo;
	foo = 100;
	function foo() {}
	var foo = 111;
}
console.log(bar()); 
console.log(bar());
function bar() {
	foo = 10;
	function foo() {}
	var foo = 11;
	return foo;
}

类型转化相关

if (typeof (a) && -true + (-undefined) + "") {
		document.write("基础扎实");
}
if(11 + "11" * 2 == 33){
	document.write("基础扎实");
}
!!" " + !!"" - !!false || document.write('你觉得能打印,你就是猪');

暂时未知类型

(window.x || (window.x = "bar")); 
console.log(window.x);

本文地址:https://blog.csdn.net/leowahaha/article/details/107569721