You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the short primitive data type that allow to overcome the differences between Java and JavaScript.
The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).
Expected Behavior
Declaring a variable to refer to a short
Creating, Initializing, and Accessing a short
initialize with hexadecimal
initialize with binary
Equality and Relational Operators
equal to
not equal to
greater than
greater than or equal to
less than
less than or equal to
Arithmetic Operators
additive operator
subtraction operator
multiplication operator
division operator
remainder operator
Unary Operators
unary plus operator
unary minus operator
increment operator
decrement operator
Exception
incompatible types: possible lossy conversion with int, long, float o double
incompatible types: cannot be converted to short
Acceptance test
Declaring a variable to refer to a short
letaShort: Jshort;
Creating, Initializing, and Accessing a short
constanShort=jshort('26');console.log("Short: "+aShort);// initialize with hexadecimalconstanHex=jshort('0x1a');console.log("Hex: "+anHex);// initialize with binaryconstaBin=jshort('0b11010');console.log("Bin: "+aBin);
Implement the short primitive data type that allow to overcome the differences between Java and JavaScript.
Expected Behavior
Acceptance test
Declaring a variable to refer to a short
Creating, Initializing, and Accessing a short
Output:
Equality and Relational Operators
Output:
Arithmetic Operators
Output:
Unary Operators
Output:
Exceptions
Output:
The text was updated successfully, but these errors were encountered: