- A"number"
- B"string"
- C "boolean"
- D"undefined"
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
The typeof operator in JavaScript returns a string indicating the type of the operand. In this case, the operand is the variable num, which has been assigned the value of 10, which is a number. Therefore, the typeof operator will return "number".
The && operator in JavaScript performs a logical AND operation on its operands.
If both operands are truthy, the result is true, otherwise the result is false.
In this case, the first operand (x) is truthy (true), but the second operand (y) is falsy (false), so the result of the && operation is false.
In JavaScript, variables are dynamically-typed, which means that their type can change at runtime.
In this case, the variable num is initially assigned the value 10, which is a number.
However, on the second line, num is assigned the value "Hello", which is a string.
Therefore, the typeof operator will return "string" when it is called on num.
In JavaScript, the + operator can be used to concatenate strings.
In this case, the + operator is used to concatenate the string "Hello" with the number 10
Since one of the operands is a string, the + operator will treat both operands as strings and perform string concatenation.
The result will be the string "Hello10"
The toUpperCase() method in JavaScript is a string method that converts all the characters in a string to uppercase.
In this case, the toUpperCase() method is called on the string "Hello", which converts all the characters in the string to uppercase.
The result is the string "HELLO", which is logged to the console.
The Set data type in JavaScript is a constructor that creates a new set object, which is a collection of unique values.
The add method is used to add a new value to the set object.
The has method is used to determine whether the set object includes the specified value.
In this case, two values are added to the set object using the add method.
The has method is called on the set object, with the value 2 as the argument.
Since the set object includes the value 2, the has method will return true.
The Object.is method in JavaScript is a method that can be used to determine whether two values are the same.
In this case, the Object.is method is called with obj and an empty object as the arguments.
Although obj and the empty object may seem similar, they are actually two distinct objects and are not the same.
Therefore, the Object.is method will return false.
The Array.isArray method in JavaScript is a method that can be used to determine whether a value is an array.
In this case, the Array.isArray method is called with the array [1, 2, 3] as the argument.
Since the value is an array, the Array.isArray method will return true.
This function takes in a single argument, name, and returns a greeting string that includes the name.
This function takes in a single argument, radius, and uses the Math.PI constant and the radius to calculate the area of a circle.