src
ext
script
link
A. src
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
var grade='E';
var result;
switch(grade)
{
case 'A':
result+=10;
case 'B':
result+= 9;
case 'C':
result+= 8;
default:
result+= 0;
}
document.write(result);
10
0
18
17
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
function printArray(a)
{
var len = a.length, i = 0;
if (len == 0)
console.log(Empty Array);
else
{
do
{
console.log(a[i]);
} while (++i < len);
}
}
Prints the numbers in the array in order
Prints the numbers in the array in the reverse order
Prints 0 to the length of the array
Prints Empty Array
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
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 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
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
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
src
ext
script
link
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
var a = [];
a.unshift(1);
a.unshift(22);
a.shift();
a.unshift(3,[4,5]);
a.shift();
a.shift();
a.shift();
1
[4,5]
[3,4,5]
Exception is thrown
00
0x
0X
Both 0x and 0X
o.m(x) && o.m(y);
o[m](x,y);
o(m)[x,y];
o.m(x && y);
Procedures
Method
Static function
Dynamic function
the head tag
the head or body
the title or head
after the body tag
isPrototypeOf() method
equals() method
=== operator
==opertor
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
1
2
3
error
Syntax error
Missing of semicolons
Division by zero
Missing of Bracket
prototype stack
prototype chain
prototype class
prototypes
function f() {};
Function f
A custom constructor
Prototype of a function
Not valid
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
int sum=0;
var arr = [10,15,20,30];
arr.forEach(function myFunction(element)
{
sum= sum+element;
});
document.writeln(sum);
70
75
10
error
Object-Oriented
High-level
Assembly-language
Object-Based
Floating numbers
Representation of functions that returns a value
is not present in JavaScript
Form feed
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
switch(expression)
{
statements
}
==
equals
equal
===
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation
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