zoukankan      html  css  js  c++  java
  • javascript入门教程02

    JavaScript中的运算符

    (1)算术运算符

    + :相加

    var a=123,b=45;
    document.write(a+b);

    - :相减

    document.write(a-b);

    *:相乘

    document.write(a*b);

    / :相除

    document.write(a/b);

    % :取余(10/3=3...1,1就是余数)

    document.write(a%b);

    ++ :自加一

    document.write(a++);

    -- :自减一

    document.write(a--);

    (2)赋值运算符

    =

    width=45;

    (3)比较运算符

    >

    <

    >=

    <=

    ==

    !=

    (4)

    逻辑运算符

    &&:与运算符(运算符左右两边的都为true,整体才为true)

    || :或运算符(两边只要有一个为true,整体就为true)

    !:非运算符(取反)

  • 相关阅读:
    Velocity Obstacle
    游戏AI技术 2
    游戏AI技术
    状态同步
    Realtime Rendering 1.1
    Steering Behaviors
    Realtime Rendering 6
    网络同步
    War3编辑器
    Realtime Rendering 5
  • 原文地址:https://www.cnblogs.com/fjiqiang/p/10056485.html
Copyright © 2011-2022 走看看