Operator |
Java |
Go |
Python |
Javascript |
++, – |
statement |
not statement, expression |
N/A |
supported |
logical |
&,|,&&,||,! |
&&,||,! |
and, or, not |
&&,||,! |
bitwise not |
~x |
^x |
~x |
~x |
bitwise and |
x & y |
x & y |
x & y |
x & y |
bitwise or |
x | y |
x | y |
x | y |
x | y |
bitwise exclusive or |
x ^ y |
x ^ y |
x ^ y |
x ^ y |
bitwise clear (and not) |
N/A |
&^ |
N/A |
N/A |
?: (ternary op) |
supported |
N/A |
N/A |
supported |
- Java:
&, |
also have the logical function. But it differents with &&, ||
which have short circuiting function.
- javascript special operator
- instanceof: Test object class
- in: Test whether property exists,
prop in objectName
- in object: test property whether in object
- ** in array**: test index (not element) whether in array
- 1
- 2
- 3
- 4
- 5
| - var testInArray = [7, 8, 9];
- "0" in testInArray; // true
- 1 in testInArray; // true
- "7" in testInArray; // false
- 8 in testInArray; // false
|
- delete: Remove a property
- typeof: Determine type of operand
- void: return undefined value
>>>
: Shift right with zero extension
- ===, !== : Test for strict equality/inequality, type and value should be tested.
- !!x: get equality of boolean of x
- go
- ++, –: only supports post increment/decrement
- 1
- 2
- 3
- 4
- 5
| - Int demoInt2 = demoInt1++
- ++demoInt1
- - x ==y, x != y
- - x.equals(y)
|
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
| - >>>a**b == pow(a, b)
- >>>(a//b, a%b) == (a//b, a%b) == divmod(a, b)
- >>> x == y, x !=y
- >>> x is y, x is not y
- x in y, x not in y
- >>> abs(-5) == 5
- True
- >>> a = 2
- >>> ~a
- >>> from struct import pack
- >>> pack('b', -1)
- '\xff'
- min(), max(), sum(), cmp()
|
- 1
- 2
- 3
- 4
- 5
| - demoInt2 := demoInt1++
- ++demoInt1
- x := 2
- x, ^x
|