var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
1
0
Null
Undefined
A. 1
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
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}
The continue keyword restarts the loop
The continue keyword skips the next iteration
The continue keyword skips the rest of the statements in that iteration
The continue keyword breaks out of the loop
An integer
A String
An object
Floating point
Reverses and stores in the same array
Reverses and concatenates the elements of the array
Reverses
Stores the elements of an array in normal order
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
The interpreter stops its work
The interpreter throws another exception
The interpreter jumps to the nearest enclosing exception handler
The interpreter throws an error
Properties
Prototypes
Lvalue
Definition
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
const obj1 =
{
property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);
true 21
true false
true true
false false
int a==2;
int b=4;
int ans=a+b;
print(ans);
2
6
0
error
Volatile variable
Mutable variable
Immutable variable
Dynamic variable
function printprops(o)
{
for(var p in o)
console.log(p + : + o[p] +
);
}
Prints the contents of each property of o
Returns undefined
Prints only one property
Prints the address of elements
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
1.01
1.047
1.00
1.4
var arr = [7, 5, 9, 1];
var min = Math.min.apply(null, arr);
document.writeln(min);
7
5
1
9
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
Procedures
Method
Static function
Dynamic function
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
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;
x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));
x = a?b:(c?d:(e?f:g));
q = ~(-y); w = (x = (y = z));
x = (x = (y = z));w = ~(-y);
q = a?b:(c?d:(e?f:g));
x = ~(-y); w = (x = (y = z));
q = (c?d:(e?f:g));
Returns the value and continues executing rest of the statements, if any
Returns the value and stops the program
Returns the value and stops executing the function
Stops executing the function and returns the value
maps the elements of another array into itself
passes each element of the array and returns the necessary mapped elements
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
pass the elements of the array into another array
var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
Keywords
Declaration statements
Data types
Prototypes
var a = [1,2,3,4,5];
a.slice(0,3);
Returns [1,2,3]
Returns [4,5]
Returns [1,2,3,4]
Returns [1,2,3,4,5]
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
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
Prints an exception error
Prints an overflow error
Displays Infinity
Prints the value as such