Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
C. 1
Function prototype
Function literal
Function calling
Function declaration
var book = {
main title: JavaScript,
'sub-title': The Definitive Guide,
for: all audiences,
author: {
firstname: David,
surname: Flanagan
}
};
properties
property values
property names
objects
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);
5
555
3
error
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
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
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
o.m=m.f;
o.m=f;
o=f.m;
o=f;
debugger
with
if
use strict
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
135
123
013
01
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
7.25
-7.25
7
-7
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
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
o(x,y);
o.m(x) && o.m(y);
m(x,y);
o.m(x,y);
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
parse
a sync
defer
type
Prints an exception error
Prints an overflow error
Displays Infinity
Prints the value as such
isPrototypeOf() method
equals() method
=== operator
==opertor
switch(expression)
{
statements
}
==
equals
equal
===
var values=[one,two,Three];
var ans=values.shift();
document.writeln(ans);
one
two
three
error
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
Keywords
Declaration statements
Data types
Prototypes
Controlled loop constructs
Case checking constructs
Validation constructs
All of the mentioned
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
125
25
5
Error
00
0x
0X
Both 0x and 0X
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
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
function equalto()
{
int num=10;
if(num===10)
return true;
else
return false;
}
true
false
runtime error
compilation error
String
Object
Serialized Object
Array