js-QuickStart-base.js
// 1.变量(Variables) var myVariable; myVariable = 'Bob'; // 数据类型 string number boolean array object // 2.注释 /* Everything in between is a comment. */ // 3.运算符 + - * / = === ! !== // 4.语句 var iceCream = 'chocolate'; if (iceCream === 'chocolate') { alert('Yay, I love chocolate ice cream!'); } else { alert('Awwww, but chocolate is my favorite...'); } // 5.函数 function multiply(num1,num2) { var result = num1 * num2; return result; } multiply(4,7); // 6.事件 document.querySelector('html').onclick = function() { alert('Ouch! Stop poking me!'); }