21. Do functions in JavaScript necessarily return a value ?
22. Consider the following code snippet :
var tensquared = (function(x) {return x*x;}(10));
Will the above code work ?
var tensquared = (function(x) {return x*x;}(10));
23. Consider the following code snippet :
var string2Num=parseInt("123xyz");
The result for the above code snippet would be :
var string2Num=parseInt("123xyz");
24. If you have a function f and an object o, you can define a method named m of o with
25. For the below mentioned code snippet:
var o = new Object();
The equivalent statement is:
var o = new Object();
26. What is the difference between the two lines given below ?
!!(obj1 && obj2);
(obj1 && obj2);
!!(obj1 && obj2);
(obj1 && obj2);
27. Consider the following code snippet :
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
The state stored in d is :
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
28. Consider the following code snippet :
var c = counter(), d = counter();
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()
What does the last statement return ?
var c = counter(), d = counter();
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()