CSE :: Javascript - CS
-
Consider the following code snippet
function oddsums(n)
{
let total = 0, result=[];
for(let x = 1; x <= n; x++)
{
let odd = 2*x-1;
total += odd;
result.push(total);
}
return result;
}
What would be the output ifoddsums(5);
is executed afted the above code snippet ?
-
Consider the following code snippet
console.log(p)
If p is not defined, what would be the result or type of error?
-
Consider the following code snippet
let x=x+1;
console.log(x);
What will be the result for the above code snippet?
-
Consider the following code snippet
[x,y]=[y,x];
What is the result of the above code snippet?
- Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?
- Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?
- Which method of the iterable object returns an iterator object for the collection?
-
Consider the following code snippet
let succ = function(x) x+1, yes = function() true, no = function() false;
What convenience does the above code snippet provide?
-
Consider the following code snippet
data.sort(function(a,b),b-a);
What does the above code do?
- What is the code to be used to trim whitespaces ?