function printArray(a)
{
var len = a.length, i = 0;
if (len == 0)
console.log("Empty Array");
else
{
do
{
console.log(a[i]);
} while (++i < len);
}
}
Answer: Prints the numbers in the array in order
Answer: Initialization,Testing, Updation
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
Answer: Yes, this will work
for(var p in o) console.log(o[p]);
Answer: for (var i = 0;i < a.length;i++)
console.log(a[i]);
Answer: Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
Answer: That property will not be enumerated
Answer: The interpreter jumps to the nearest enclosing exception handler
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}
Answer: The continue keyword skips the rest of the statements in that iteration
function f(o)
{
if (o === undefined) debugger;
}
Answer: It does nothing but a simple breakpoint
Answer: use strict
function range(int length)
{
int a=5;
for(int i=0;i< length;i++)
{
console.log(a);
}
}
range(3);
Answer: 555
var a = 10;
do {
a += 1;
console.log(a);
} while (a < 5);
Answer: 11
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
Answer: 135
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j--)
{
console.log(a);
a=a-2;
}
Answer: 531-1
int a=0;
for(a;a<5;a++);
console.log(a);
Answer: 5