码迷,mamicode.com
首页 > Web开发 > 详细

js-QuickStart-base.js

时间:2015-11-12 18:02:50      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

// 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!‘);
    }

 

js-QuickStart-base.js

标签:

原文地址:http://www.cnblogs.com/cynthia-wuqian/p/4959347.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!