ข้อกำหนดพื้นฐานใน JavaScript
การเขียนคำสั่ง Statement
Single Statementvar a = 10;
var b = 'Hello word';
var c = true;
Compound Statement
if( a>1){
คำสั่ง...;
...;
}
การใช้เครื่องหมาย ';' เป็นจุดสิ้นสุด คำสั่ง
var a = 10; var b = 'Hello word'; var c = true;การเขียนแยกบรรทัด
var x = 20+5+6+6230+46+57+58+54;
การเขียนคำอธิบายโค้ด
ใช้เครื่องหมาย '//' Slash 2 ตัวvar a = 10; //กำหนดตัวแปล
ใช้เครื่องหมาย '/* */' ดอกจันทร์และ Slash
var a = 10; /*กำหนดตัวแปล*/
/* การกำหนดตัวแปล
สำหรับ เก็บตัวเลข */
var a = 10;
คำสงวน(Reserved words)
abstract | arguments | await* | boolean |
break | byte | case | catch |
char | class* | const | continue |
debugger | default | delete | do |
double | else | enum* | eval |
export* | extends* | false | final |
finally | float | for | function |
goto | if | implements | import* |
in | instanceof | int | interface |
let* | long | native | new |
null | package | private | protected |
public | return | short | static |
super* | switch | synchronized | this |
throw | throws | transient | true |
try | typeof | var | void |
volatile | while | with | yield |
ไม่มีความคิดเห็น:
แสดงความคิดเห็น