js單詞形式的運(yùn)算符
1.void 運(yùn)算表達(dá)式并忽略其返回值,比如void (1+2),void (0)
<html>
<head>
<meta http-equiv="content-type" charset="utf-8"/>
<script type="text/javascript">
alert(typeof(void(0))); //void(0) 計(jì)算值為0,由于忽略返回值,typeof類型為:undefined
</script>
</head>
<body>
1.用onclick事件來靈活處理;2.void(expression)<br>
<a href="javascript:void(0);" onclick="location.>百度</a>
<a href="javascript:void(location.>谷歌</a>
</body>
</html>
2.typeof 返回變量或值的類型,比如 typeof(void 1+2) ,typeof(void(1+2))
由于運(yùn)算符優(yōu)先級(jí),void 1+2 的運(yùn)算過程為:
3.new用于創(chuàng)建指定類的對(duì)象實(shí)列
4.delete刪除實(shí)列屬性,對(duì)于delete有幾點(diǎn)必須注意:
1.只刪除實(shí)列屬性,而不會(huì)刪除對(duì)象
<html>
<head>
<meta http-equiv="content-type" charset="utf-8"/>
<script type="text/javascript">
var parent={};
var son={age:10};
parent.son=son;
alert(parent.son.age);//10
delete parent.son;
alert(parent.son);//undefined
alert(son.age);//10
</script>
</head>
<body>
</body>
</html>
相關(guān)文章
淺析JavaScript 箭頭函數(shù) generator Date JSON
下面小編就為大家?guī)硪黄獪\析JavaScript 箭頭函數(shù) generator Date JSON。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05
URL編碼轉(zhuǎn)換,escape() encodeURI() encodeURIComponent()
URL編碼轉(zhuǎn)換,escape() encodeURI() encodeURIComponent()...2006-12-12
JavaScript中指定函數(shù)名稱的相關(guān)方法
這篇文章主要介紹了JavaScript中指定函數(shù)名稱的相關(guān)方法,是JS入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下2015-06-06
在JavaScript的正則表達(dá)式中使用exec()方法
這篇文章主要介紹了在JavaScript的正則表達(dá)式中使用exec()方法,是JS入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下2015-06-06

