stand-alone expressions
basic expressions containing all necessary functions
contains variable references alone
contains only keywords
A. stand-alone expressions
continue statement
break statement
goto statement
return statement
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
in
exist
within
exists
It returns the value 0
It will throw an exception
It returns the undefined value
It will throw an error
const object1 = {
property1: 20
};
console.log(Object.is(object1));
20
true
false
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
Alternative to if-else
Immediate if
If-then-else statement
Switch statement
prototype stack
prototype chain
prototype class
prototypes
var txt1 = good;
var txt2 = day;
document.getElementById(demo).innerHTML = txt1 + txt2;
good day
goodday
error
undefined
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j--)
{
console.log(a);
a=a-2;
}
5555
5321
531-1
531
var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
<script>
var x = 10;
x *= 5;
document.getElementById("demo").innerHTML = x;
</script>
5
10
50
Error
int a=4;
int b=1;
int c=0;
If(a==b)
document.write(a);
else if(a==c)
document.write(a);
else
document.write(c);
4
1
Error
0
o.m(x) && o.m(y);
o[m](x,y);
o(m)[x,y];
o.m(x && y);
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
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
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
debugger
with
if
use strict
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]);
var tensquared = (function(x) {return x*x;}(10));
Yes, perfectly
Error
Exception will be thrown
Memory leak
Keywords
Declaration statements
Data types
Prototypes
Both a and b are equal in value, type and reference address
Both a and b are equal in value
Both a and b are equal in value and type
There is no such statement
Properties
Prototypes
Lvalue
Definition
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
1.01
1.047
1.00
1.4
Identifier and Parentheses
Return type and Identifier
Return type, Function keyword, Identifier and Parentheses
Identifier and Return type
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
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
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
135
123
013
01