Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
A. Ignores the 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
o.m(x) && o.m(y);
o[m](x,y);
o(m)[x,y];
o.m(x && y);
An integer
A String
An object
Floating point
isarrayType()
==
===
typeof
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
When the function is defined as a looping statement
When the function is defined as expressions
When the function is predefined
when the function is called
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);
5
555
3
error
It is mandatory
Not necessary
Few functions return values by default
some functions do not return any value
o.m=m.f;
o.m=f;
o=f.m;
o=f;
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
Procedures
Method
Static function
Dynamic function
!!(obj1 && obj2);
(obj1 && obj2);
Both the lines result in a boolean value True
Both the lines result in a boolean value False
Both the lines checks just for the existence of the object alone
The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2
true false
false true
true true
false true
function output(object)
{
var place=object ? object.place : Italy;
return clean:+ place;
}
console.log(output({place:India}));
clean:India
clean:Italy
error
undefined
o(x,y);
o.m(x) && o.m(y);
m(x,y);
o.m(x,y);
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 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
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation
Floating numbers
Representation of functions that returns a value
is not present in JavaScript
Form feed
Alternative to if-else
Immediate if
If-then-else statement
Switch statement
var book = {
main title: JavaScript,
'sub-title': The Definitive Guide,
for: all audiences,
author: {
firstname: David,
surname: Flanagan
}
};
properties
property values
property names
objects
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
false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)
switch(expression)
{
statements
}
==
equals
equal
===
The interpreter stops its work
The interpreter throws another exception
The interpreter jumps to the nearest enclosing exception handler
The interpreter throws an error
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
Keywords
Declaration statements
Data types
Prototypes
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 add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7