Array And Function - Study Mode
[#1] The pop() method of the array does which of the following task ?
Correct Answer
(A) decrements the total length by 1
Explanation
Solution: Arrays have a pop() method (it works with push()) that reduces the length of an array by 1 but also returns the value of the deleted element.
[#2] What will happen if reverse() and join() methods are used simultaneously ?
Correct Answer
(A) Reverses and stores in the same array
Explanation
Solution: The reverse() followed by a join() will reverse the respective array and will store the reversed array in the memory.
[#3] The primary purpose of the array map() function is that it
Correct Answer
(C) passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function
Explanation
Solution: The map() method passes each element of the array on which it is invoked to the functionyou specify, and returns an array containing the values returned by that function.
[#4] The reduce and reduceRight methods follow a common operation called
Correct Answer
(B) inject and fold
[#5] The method or operator used to identify the array is
Correct Answer
(D) typeof
Explanation
Solution: The typeof property is used to identify the array type.