關鍵字在開發工具中會顯示特殊顏色
關鍵字不能用作變數名、函式名等
關鍵字嚴格區分大小寫, var和var前者是關鍵字, 後者不是
關鍵字break
doinstanceof
typeof
case
else
newvar
catch
finally
return
void
continue
forswitch
while
default
ifthrow
delete
intry
function
this
with
debugger
false
true
null
保留字class
不建議使用識別符號
哈哈_text
jack_rose
jack&rose
gui _123
if
njquery.extend(,
ishtml : function (str) 。
if (str.charat(0) == '' && str.length >= 3)
return false;
},trim : function (str) else
}});
注釋特點/*靜態工具方法*/
njquery.extend(,
/*** 判斷是不是html片段
* @param 需要判斷的內容
* @returns 是返回true, 不是返回false
*/ishtml : function (str)
// 2.如果字串的第乙個字母是= 3,就可以認為是html片段。
if (str.charat(0) == '' && str.length >= 3)
// 3.其它情況一律返回false
return false;
},/**
* 清除字串首位空格
* @param 需要清除的字串
* @returns 清除之後的新字串
*/trim : function (str) else
}});
多行注釋
注釋使用注意/*我是被注釋的內容*/
var num;
常用注釋
_ooooo_
o8888888o
88" . "88
(| -_- |)
o\ = /o
____/`---'\____
. ' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\__/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
*****=`-.____`-.___\_____/___.-`____.-'*****=
`=---='
.............................................
佛祖保佑 有無bug
JavaScript學習筆記02
獲取方式 區別解釋 getelementbyid 根據id獲取,呼叫物件只能是docoument getelementsbyname 根據name獲取,呼叫物件只能是document getelementsbyclassname 根據class獲取,呼叫物件可以是父級和document 不相容ie8...
javascript函式基礎 this基礎
this是函式體內自帶的乙個物件指標,它能夠始終指向呼叫物件 這個this代表的物件由this所在的執行作用域決定的,而不是根據this所在的定義作用域決定。this 屬性 如果this未包含屬性,則直接傳遞的是當前物件 1.this代表當前操作物件 this即代表 物件input 2.this代表...
JavaScript 02 DOM基本操作
獲取節點 1 document getelementbyid 語法 document.getelementbyid 元素id 通過元素id獲取節點 getelementsbyname 語法 document.getelementsbyname 元素name屬性 通過元素name屬性獲取節點 gete...