非腳本語言有編譯
js腳本語言 直接啃 無編譯(代碼)
Property屬性
hasOwnProperty 在Object原型中 用于檢查某屬性是否是私有屬性
console.log(plane.hasOwnProperty("color")) 是返回true 否則false
數(shù)組下標以私有屬性存在、所以在給數(shù)組添加原型屬性時要注意、不要添加,在遍歷時會找到所添加的原型屬性 for(var n in arr){console.log(n)} n-->屬性名
in 關(guān)鍵字用來判斷某屬性是否可用 即是否是對象的私有屬性或共有屬性
對象遍歷?
用keys和getOwnPropertyName獲取鍵(屬性名)集合
var k = Object.keys(plane);
for(var i=0 ;i<k.length; i++){console.log("鍵:"+ k.[i]) +" 值:" +plane[k.[i]];}
new關(guān)鍵字--> 面試
底層屬性 隱士屬性
實參 arguments 參數(shù)的集合 不是數(shù)組 但可以用數(shù)組形式使用下標
instanceof? 看是否是構(gòu)造函數(shù)的實例
架構(gòu) 技術(shù)(充電)
回調(diào)函數(shù)作為主函數(shù)的附屬
&& || 可替代簡單的if語句 afterWork && afterWork();
|| 備用處理 (備用值) var obj = param || "男";前面值無效執(zhí)行后面的值,后面值作為備用值
&& 校驗
健壯性-->適應(yīng)的場景多
callback回調(diào) callback && callback();
架構(gòu)好 才好
keys getOwnPropertyName Object.keys(對象)獲取鍵/屬性名集合
hasOwnPropertyName hasOwnPropertyName 對象.hasOwnPropertyName("color")
callback callback afterWork afterWork afterWork arguments arguments arguments
arguments arguments arguments instanceof instanceof instanceof instanceof
instanceof arguments arguments afterWork afterWork afterWork target target
target target target arguments arguments argument arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments instanceof instanceof instanceof instanceof instanceof instanceof instanceof instanceof instanceof instanceof instanceof arguments instanceof
需要等 要用回調(diào)函數(shù)(匿名函數(shù))
***事件代理() 減少了綁定的事件數(shù)量
事件委托大大減少頁面綁定事件數(shù)量 提高了頁面性能
事件委托針對節(jié)點動態(tài)變化場景 無序重新綁定
學(xué)號 姓名 年齡 增刪改查
競品分析
for in 遍歷時 n 是字符串形式 for(var n in arr)
在標簽上添加自定義屬性
targetName 大寫
attributes attributes attributes attributes attributes attributes attributes attributes attributes attributes arguments參數(shù)數(shù)組 arguments attributes 屬性數(shù)組
函數(shù) 數(shù)組5個常用方法 字符串常用方法 正則 常見 \s空白