false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)
D. Both false.toString() and String(false)
125
25
5
Error
switch(expression)
{
statements
}
==
equals
equal
===
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
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
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
isPrototypeOf() method
equals() method
=== operator
==opertor
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
var book = {
main title: JavaScript,
'sub-title': The Definitive Guide,
for: all audiences,
author: {
firstname: David,
surname: Flanagan
}
};
properties
property values
property names
objects
void
int
function
main
Create linkage between client side and server side
Permit server side, JavaScript code, to connect to RDBMS
Support only non relational database
To interpret JavaScript code
o.m=m.f;
o.m=f;
o=f.m;
o=f;
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
for(var num=10;num>=1;num--)
{
document.writeln(num);
}
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}
Code 1
Code 2
Both Code 1 and Code 2
Cannot Compare
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
1
0
Null
Undefined
the head tag
the head or body
the title or head
after the body tag
It returns the value 0
It will throw an exception
It returns the undefined value
It will throw an error
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
const obj1 = { property1: '10'};
const obj2 = Object.freeze(obj1);
obj2.property1 = '20';
console.log(obj2.property1);
10
20
Runtime error
Compilation error
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
135
123
013
01
const obj = {prop: 12};
Object.preventExtensions(obj);
console.log( Object.isExtensible(obj));
12
false
true
error
Identifier and Parentheses
Return type and Identifier
Return type, Function keyword, Identifier and Parentheses
Identifier and Return type
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
Alternative to if-else
Immediate if
If-then-else statement
Switch statement
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 add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
function code(id,name)
{
this.id = id;
this.name = name;
}
function pcode(id,name)
{
code.call(this,id,name);
}
document.writeln(new pcode(101,vivek).id);
vivek
101
Runtime error
Compilation error
var count = [1,,3];
The omitted value takes undefined
This results in an error
This results in an exception
The omitted value takes an integer value
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
<script>
var x = 5;
var y = 2;
var z = x % y;
document.getElementById("demo").innerHTML = z;
</script>
0
1
2
5
7.25
-7.25
7
-7