1 . CSS和JS在網(wǎng)頁中的放置順序
2 . 解釋白屏
和FOUC
3 . async
和defer
的作用,區(qū)別
4 . 簡述網(wǎng)頁的渲染機制
5 . JavaScript 定義了幾種數(shù)據(jù)類型? 哪些是簡單類型?哪些是復(fù)雜類型?
6 . NaN
、undefined
辉川、null
分別代表什么
7 . typeof
和instanceof
的作用和區(qū)別
代碼
1 . 完成如下代碼判斷一個變量是否是數(shù)字、字符串矗钟、布爾痒给、函數(shù) (難度*)
ps: 做完后可參考 underscore.js 源碼中部分實現(xiàn)
function isNumber(el){
// todo ...
}
function isString(el){
//todo ...
}
function isBoolean(el){
//todo ...
}
function isFunction(el){
//todo ...
}
var a = 2,
b = "jirengu",
c = false;
alert( isNumber(a) ); //true
alert( isString(a) ); //false
alert( isString(b) ); //true
alert( isBoolean(c) ); //true
alert( isFunction(a)); //false
alert( isFunction( isNumber ) ); //true
2 . 以下代碼的輸出結(jié)果是?(難度**)
console.log(1+1);
console.log("2"+"4");
console.log(2+"4");
console.log(+new Date());
console.log(+"4");
3 . 以下代碼的輸出結(jié)果是? (難度***)
var a = 1;
a+++a;
typeof a+2;
4 . 遍歷數(shù)組贪薪,把數(shù)組里的打印數(shù)組每一項的平方 (難度**)
var arr = [3,4,5]
// todo..
// 輸出 9, 16, 25
5 . 遍歷 JSON, 打印里面的值 (難度**)
var obj = {
name: 'hunger',
sex: 'male',
age: 28
}
//todo ...
// 輸出 name: hunger, sex: male, age:28
6 . 下面代碼的輸出是? 為什么 (難度***)
console.log(a);
var a = 1;
console.log(a);
console.log(b);