Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
B. Object Creation Expression
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
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
function output(object)
{
var place=object ? object.place : Italy;
return clean:+ place;
}
console.log(output({place:India}));
clean:India
clean:Italy
error
undefined
isPrototypeOf() method
equals() method
=== operator
==opertor
var string1 = 123;
var intvalue = 123;
alert( string1 + intvalue );
123246
246
123123
Exception
var count = 0;
while (count < 10)
{
console.log(count);
count++;
}
The values of count are logged or stored in a particular location or storage
The value of count from 0 to 9 is displayed in the console
An error is displayed
An exception is thrown
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
Properties
Prototypes
Lvalue
Definition
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 o = new Object();
var o = Object();
var o;
var o= new Object;
Object o=new Object();
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
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 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)
7.25
-7.25
7
-7
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
Prints an exception error
Prints an overflow error
Displays Infinity
Prints the value as such
void
int
function
main
+
:
^
?:
function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}
true
false
runtime error
logical error
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
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
prototype stack
prototype chain
prototype class
prototypes
int a==2;
int b=4;
int ans=a+b;
print(ans);
2
6
0
error
Syntax error
Missing of semicolons
Division by zero
Missing of Bracket
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]);
directly into JS file and included into HTML
directly on the server page
directly into HTML pages
directly into the css file
if(a!=null)
if (!a)
if(a!null)
if(a!==null)
in
exist
within
exists
Primary expression
Functional expression
Invocation expression
Property Access Expression