2016年10月30日--JavaScript文法

來源:互聯網
上載者:User

標籤:通用   日期   for   日期時間   整數   資料   ++   邏輯運算子   java   

1、基礎資料型別 (Elementary Data Type):字串、小數、整數、日期時間、布爾型等。

2、變數:【var】定義變數:var a;所有變數定義都用var定義,var是通用的可變類型。

3、類型轉換:轉為整數:parseInt();  轉為小數:parseFloat();

4、運算子:

數學運算子:+ - * / % ++ --;

關係運算子:==  !=  >  >=  <  <=;

邏輯運算子:&&  ||  !;

其它運算子:+= -= *= /= %= ?:

5、語句:分為順序,分支和迴圈語句。

分支:if(){}else{}       switch(){case :break;}

迴圈:for(;;){}

6、數組:var array = new Array();   取值:array[0];

7、函數:定義函數:function 函數名(參數) { 函數體 }     傳回值可以是var類型也可以return個值

 

 

彈窗:

alert("alert");取消 叉
confirm("confirm");確定 取消 叉
prompt("prompt","你輸入啊");輸入 確定 取消 叉

2016年10月30日--JavaScript文法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.