var count = [1,,3];
Answer: The omitted value takes “undefined”
var count = [1,,3];
Answer: The omitted value takes “undefined”
var a1 = [,,,]; var a2 = new Array(3); 0 in a1 0 in a2
Answer: true false
Article and Schedule Quiz | Start Test! |
Answer: decrements the total length by 1
if (!a[i]) continue;
Answer: Skips the null elements
Answer: Reverses and stores in the same array
var a = [1,2,3,4,5];
a.slice(0,3);
Answer: Returns [1,2,3]
var a = []; a.unshift(1); a.unshift(22); a.shift(); a.unshift(3,[4,5]); a.shift(); a.shift(); a.shift();
Answer: 1
Answer: 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
Answer: inject and fold
var val1=[1,2,3]; var val2=[6,7,8]; var result=val1.concat(val2); document.writeln(result);
Answer: 1, 2, 3, 6, 7, 8
var values=[1,2,3,4] var ans=values.slice(1); document.writeln(ans);
Answer: error
int sum=0; var arr = [10,15,20,30]; arr.forEach(function myFunction(element) { sum= sum+element; }); document.writeln(sum);
Answer: 75
var values=["one","two","Three"]; var ans=values.shift(); document.writeln(ans);
Answer: one
var arr=[1,2,3]; var rev=arr.reverse(); document.writeln(rev);
Answer: 3, 2, 1