Javascript教程:null類型

來源:互聯網
上載者:User

文章簡介:這裡我們提 null 的主要目的是為了說一點,如果我們定義一個變數,而這個變數未來是用於儲存物件的,此時,我們最好將這個變數初始化為 null ,這樣以來,只要檢測null 值就可以知道這個變數是否已經儲存了一個對象的引用了。

 null 類型是第二個只有一個值的資料類型,它的值就是null ,null 值表示一個Null 物件指標,所以使用 typeof 操作符檢測null 的時候是一個對象。element
Font
font-family  
font-size  
font-style  
font-variant  
font-weight  
letter-spacing  
line-height  
text-decoration  
text-align  
text-indent  
text-transform  
white-space  
word-spacing  
color  
Background
bg-attachment  
bg-color  
bg-image  
bg-position  
bg-repeat  
Box
width  
height  
border-top  
border-right  
border-bottom  
border-left  
margin  
padding  
max-height  
min-height  
max-width  
min-width  
outline-color  
outline-style  
outline-width  
Positioning
position  
top  
bottom  
right  
left  
float  
display  
clear  
z-index  
List
list-style-image  
list-style-type  
list-style-position  
Table
vertical-align  
border-collapse  
border-spacing  
caption-side  
empty-cells  
table-layout  
Effects
text-shadow  
-webkit-box-shadow  
border-radius  
Other
overflow  
cursor  
visibility  
這裡我們提 null 的主要目的是為了說一點,如果我們定義一個變數,而這個變數未來是用於儲存物件的,此時,我們最好將這個變數初始化為 null ,這樣以來,只要檢測null 值就可以知道這個變數是否已經儲存了一個對象的引用了。var car = null;if(car != null){}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.