Properties
Prototypes
Lvalue
Definition
C. Lvalue
It is mandatory
Not necessary
Few functions return values by default
some functions do not return any value
function output(option)
{
return (option ? yes : no);
}
bool ans=true;
console.log(output(ans));
Yes
No
Runtime error
Compilation error
var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
RMI
Triggering Event
Preprocessor
Function/Method
Prints an exception error
Prints an overflow error
Displays Infinity
Prints the value as such
<script>
var x = 10;
x *= 5;
document.getElementById("demo").innerHTML = x;
</script>
5
10
50
Error
o.m=m.f;
o.m=f;
o=f.m;
o=f;
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
+
:
^
?:
filter and fold
inject and fold
finger and fold
fold
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation
125
25
5
Error
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
switch(expression)
{
statements
}
==
equals
equal
===
false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)
var arr = [7, 5, 9, 1];
var value = Math.max.apply(null, arr);
document.writeln(value);
7
5
1
9
<script>
txt1 = “ one”;
txt1 += “two”;
document.getElementById("demo").innerHTML = txt1;
</script>
onetwo
one two
error
undefined
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 range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);
5
555
3
error
It returns the value 0
It will throw an exception
It returns the undefined value
It will throw an 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
switch(expression)
{
statements
}
==
equals
equal
===
const obj1 =
{
property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);
true 21
true false
true true
false false
An integer
A String
An object
Floating point
isPrototypeOf() method
equals() method
=== operator
==opertor
Class, parameters, objects extensible flag
Prototype, class, objects parameters
Prototype, class, objects extensible flag
Native object, Classes and Interfaces and Objects extensible flag
directly into JS file and included into HTML
directly on the server page
directly into HTML pages
directly into the css file
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
1
2
3
error