- B'55'
- C'0'
- D'5'
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
The result of the code is 0 .
In JavaScript, the - operator performs subtraction if both operands are numbers. .
In this case, the string '5' is converted to the number 5, so the final result is 5 - 5 = 0..
The result of the code is false.
The && operator in JavaScript performs a logical and operation, which means that it returns true only if both operands are truthy.
In this case, the first operand is truthy (true), but the second operand is false then the result is also false
The || operator in JavaScript performs a logical OR operation on its operands.
If either operand is truthy, the result is true, otherwise the result is false.
In this case, the first operand (x) is truthy (true), so the result of the || operation is true, regardless of the value of the second operand (y).
The instanceof operator in JavaScript is used to determine whether an object is an instance of a particular constructor or class.
In this case, the variable obj has been assigned an empty object.
The instanceof operator is called on obj, with Object as the right operand.
Since obj is an instance of the Object constructor, the instanceof operator will return true.
Answer: C
Explanation: Seven months have a length of 31 days: January, March, May, July, August, October, and December.
The << operator in JavaScript is the left shift operator, which performs a bitwise left shift operation on its operands.
In this case, the << operator is called on x and y, with x as the first operand and y as the second operand.
Since x is 10 and y is 20, the result of the << operator will be the left shift of the binary representation of 10 by 20 bits, which is 100000 in decimal.
The >> operator in JavaScript is the right shift operator, which performs a bitwise right shift operation on its operands.
In this case, the >> operator is called on x and y, with x as the first operand and y as the second operand.
Since x is 10 and y is 20, the result of the >> operator will be the right shift of the binary representation of 10 by 20 bits, which is 0 in decimal.
The in operator in JavaScript is used to determine whether an object has a particular property.
In this case, the in operator is called on x and y, with x as the left operand and y as the right operand.
Since y is a string and does not have any properties, the in operator will return false.
The ^ operator in JavaScript is the bitwise XOR operator, which performs a bitwise XOR operation on its operands.
In this case, the ^ operator is called on x and y, with x as the first operand and y as the second operand.
Since x is 10 and y is 20, the result of the ^ operator will be the bitwise XOR of the binary representations of 10 and 20, which is 30 in decimal.
The startsWith method in JavaScript is a method that can be called on a string value to determine whether the string starts with the specified string.
In this case, the startsWith method is called on the string "Hello World!", with the string "Hello" as the argument.
Since the string "Hello World!" does start with the string "Hello", the startsWith method will return true.