当前位置: 首页 > 图文教程 > 网络编程 > Javascript > Javascript常用运算符(Operators)-javascript基础教程

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript常用运算符(Operators)-javascript基础教程


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 72 ::
收藏到网摘: n/a

javascript基础教程算术运算符

运算符 运算符说明 示例 示例说明
+ 加法 x+y

如果x为整数2,y为整数5, x+y等于7

如果x为字符串"text1", y为字符串"fun",

x+y则等于"text1fun"

- 减法 x-y
* 乘法 x*y
/ 除法 x/y
% 两者相除求余数 x%y 如果x等于10, y等于3, x%y结果等于1
++ 递增 x++ 如果x等于10, x++等于11
-- 递减 y-- 如果y等于10, y--等于9

javascript基础教程逻辑运算符

运算符 运算符说明 示例 示例说明
== 等于 x==y 如果x等于2, y等于2,则x==y
=== 全等于(值相等,数据类型也相等) x===y

如果x等于整数2,y为字符串"2",

则x===y不成立

> 大于 x>y
>= 大于等于 x>=y
< 小于 x<y
<= 小于等于 x<=y
!= 不等于 x!=y
!== 不全等于 x!==y
&& 与(and) x < 10 && y > 1
! 非(not) !(x==y)
|| 或(or) x==8 || y==8

javascript基础教程赋值运算符

运算符 运算符说明 示例 示例说明
赋值 x=5 将整数5这个值赋给变量x

注意:请注意赋值(=)和等于(==)的区别。