int a=4;
int b=1;
int c=0;
If(a==b)
document.write(a);
else if(a==c)
document.write(a);
else
document.write(c);
4
1
Error
0
D. 0
RMI
Triggering Event
Preprocessor
Function/Method
debugger
with
if
use strict
o.m=m.f;
o.m=f;
o=f.m;
o=f;
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]);
var a=3.7;
var b=2;
a=ciel(a)
document.writeIn(a*b);
6
7.4
7.5
8
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
filter and fold
inject and fold
finger and fold
fold
const obj1 = { property1: '10'};
const obj2 = Object.freeze(obj1);
obj2.property1 = '20';
console.log(obj2.property1);
10
20
Runtime error
Compilation error
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
1.01
1.047
1.00
1.4
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
Identifier and Parentheses
Return type and Identifier
Return type, Function keyword, Identifier and Parentheses
Identifier and Return type
parse
a sync
defer
type
const object1 = {
property1: 20
};
console.log(Object.is(object1));
20
true
false
error
debugger
with
if
use strict
If the object inherits enumerable properties
The object does not have the properties present in the integer array indices
The delete keyword is never used
Object.defineProperty() is not used
function f() {};
Function f
A custom constructor
Prototype of a function
Not valid
var obj=
{
length:20,
height:35,
}
if (breadth' in obj === false)
{
obj.breadth = 12;
}
console.log(obj.breadth);
20
12
undefined
error
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
var arr=[1,2,3];
var rev=arr.reverse();
document.writeln(rev);
1, 2, 3
3, 2, 1
3
1
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
decrements the total length by 1
increments the total length by 1
prints the first element but no effect on the length
updates the element
o = {x:1, y:{z:[false,null,]}};
s = JSON.stringify(o);
p = JSON.parse(s);
Object Encapsulation
Object Serialization
Object Abstraction
Object Encoding
will throw errors and exceptions
must be restricted to a Unix Machine only
will work perfectly well on a Windows Machine
will be displayed as a JavaScript text on the browser
function concatenate()
{
return String.prototype.concat('', arguments);
}
function concatenate()
{
return String.prototype.apply('', arguments);
}
function concatenate()
{
return String.concat.apply('', arguments);
}
function concatenate()
{
return String.prototype.concat.apply('', arguments);
}
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
var grade='B';
var result;
switch(grade)
{
case 'A':
{
result+=10;
break;
}
case 'B':
{
result+= 9;
break;
}
case 'C':
{
result+= 8;
break;
}
default:
result+= 0;
}
document.write(result);
10
9
8
0
var text = testing: 1, 2, 3; // Sample text
var pattern = /d+/g // Matches all instances of one or more digits
text==pattern
text.equals(pattern)
text.test(pattern)
pattern.test(text)
stand-alone expressions
basic expressions containing all necessary functions
contains variable references alone
contains only keywords