var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
A. 123
Alternative to if-else
Immediate if
If-then-else statement
Switch statement
var count = 0;
while (count < 10)
{
console.log(count);
count++;
}
The values of count are logged or stored in a particular location or storage
The value of count from 0 to 9 is displayed in the console
An error is displayed
An exception is thrown
parse
a sync
defer
type
function f(o)
{
if (o === undefined) debugger;
}
It does nothing but a simple breakpoint
It debugs the error in that statement and restarts the statements execution
It is used as a keyword that debugs the entire program at once
It is used to find error in the statement
conditional block
block that contains a single statement
both conditional block and a single statement
block that combines multiple statements into a single compound statement
var grade='A';
var result;
switch(grade)
{
case 'A':
result+=10;
case 'B':
result+= 9;
case 'C':
result+= 8;
default:
result+= 0;
}
document.write(result);
10
27
8
0
Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
The iterations can be infinite when an interpreter is used
The body of the loop is executed only once
the iteration is finite when an interpreter is used
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
An integer
A String
An object
Floating point
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
No, this will throw an exception as only numerics can be used in a for loop
No, this will not iterate
Yes, this will work
No, this will result in a runtime error with the message Cannot use Linked List
o(x,y);
o.m(x) && o.m(y);
m(x,y);
o.m(x,y);
false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)
var arr=[1,2,3];
var rev=arr.reverse();
document.writeln(rev);
1, 2, 3
3, 2, 1
3
1
var values=[1,2,3,4]
var ans=values.slice(1);
document.writeln(ans);
1, 2, 3, 4
2, 3, 4
1, 3, 4
error
function f(o)
{
if (o === undefined) debugger;
}
It does nothing but a simple breakpoint
It debugs the error in that statement and restarts the statements execution
It is used as a keyword that debugs the entire program at once
It is used to find error in the statement
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2
true false
false true
true true
false true
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
conditional block
block that contains a single statement
both conditional block and a single statement
block that combines multiple statements into a single compound statement
function output(object)
{
var place=object ? object.place : Italy;
return clean:+ place;
}
console.log(output({place:India}));
clean:India
clean:Italy
error
undefined
prototype stack
prototype chain
prototype class
prototypes
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()
9
0
10
None of the mentioned
Properties
Prototypes
Lvalue
Definition
Alternative to if-else
Immediate if
If-then-else statement
Switch statement
var values=[one,two,Three];
var ans=values.shift();
document.writeln(ans);
one
two
three
error
continue statement
break statement
goto statement
return statement
<script>
var x = 5;
var y = 2;
var z = x % y;
document.getElementById("demo").innerHTML = z;
</script>
0
1
2
5
return a localised object representation
return a parsed string
return a local time in the string format
return a localized string representation of the object
Controlled loop constructs
Case checking constructs
Validation constructs
All of the mentioned
for(var p in o)
console.log(o[p]);
for (var i = 0;i < a.length;i++)
console.log(a[i]);
for (int i = 0;i < a.length;i++)
console.log(a[i]);
for (var i = 0;i <= a.length;i++)
console.log(a[i]);
for (var i = 1;i < a.length;i++)
console.log(a[i]);