Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What operators are there in JScript

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what operators are in JScript, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

Jscript has a full range of operators, including arithmetic, logic, bit, assignment, and some others.

arithmetic operators

descriptors

Negative-

Increment ++

Decreasing?

Multiplication *

Division/

modulo operation %

addition +

Subtraction-

logical operators

descriptors

Logical NOT!

less than

<   大于 >

Less than =

===

Not equal to!=

Logic and &&

logic or||

Condition (ternary operator)?:

comma,

Strictly equal ===

Not strictly equal!==

bitwise operators

descriptors

Bit by bit negation ~

Move left by position>

Unsigned right shift>>>

bitwise and &

bitwise XOR ^

bitwise OR|

assignment operator

descriptors

assignment =

Operative assignment OP=

miscellaneous operator

descriptors

delete delete

typeof operator typeof

void void

instanceof instanceof

new new

in in

The difference between ==(equality) and ===(strict equality) is that the identity operator forces values of different types before comparison. For example, comparing the identity pair string "1" with the value 1 will result in true. Strict equality does not coerce values of different types, so it assumes that the string "1" is not the same as the numeric value 1.

Basic strings, numbers, and booleans are compared by value. If their values are the same, the comparison results in equality. Objects (including Array, Function, String, Number, Boolean, Error, Date, and RegExp objects) are compared by reference. Even if two variables of these types have the same value, the comparison results in true only if they happen to be the same object.

For example:

//Two base strings with the same value.

var string1 = "Hello";

var string2 = "Hello";

//Two String objects with the same value.

var StringObject1 = new String(string1);

var StringObject2 = new String(string2);

//The comparison result is true.

if (string1 == string2)

//Execute certain commands (which will be run).

//The comparison result is false.

if (StringObject1 == StringObject2)

//Execute certain commands (will not run).

//To compare the values of String objects,

//Use toString() or valueOf() methods.

if (StringObject1.valueOf() == StringObject2)

//Execute certain commands (which will be run).

About "what operators are in JScript" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report