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
D. block that combines multiple statements into a single compound statement
Function prototype
Function literal
Function calling
Function declaration
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
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 concatenate()
{
return String.prototype.concat('', arguments);
}
function concatenate()
{
return String.prototype.apply('', arguments);
}
function concatenate()
{
return String.concat.apply('', arguments);
}
function concatenate()
{
return String.prototype.concat.apply('', arguments);
}
RMI
Triggering Event
Preprocessor
Function/Method
var arr = [7, 5, 9, 1];
var min = Math.min.apply(null, arr);
document.writeln(min);
7
5
1
9
prototype stack
prototype chain
prototype class
prototypes
make computations in HTML simpler
minimize storage requirements on the web server
increase the download time for the client
increase the loading time of the website
Keywords
Declaration statements
Data types
Prototypes
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
135
123
013
01
in
exist
within
exists
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
o.m(x) && o.m(y);
o[m](x,y);
o(m)[x,y];
o.m(x && y);
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
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
var arr = [7, 5, 9, 1];
var value = Math.max.apply(null, arr);
document.writeln(value);
7
5
1
9
var pow=new Function(num1,num2,return Math.pow(num1,num2));
document.writeln(pow(2,3));
2
3
8
error
function code(id,name)
{
this.id = id;
this.name = name;
}
function pcode(id,name)
{
code.call(this,id,name);
}
document.writeln(new pcode(101,vivek).id);
vivek
101
Runtime error
Compilation error
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
var val1=[1,2,3];
var val2=[6,7,8];
var result=val1.concat(val2);
document.writeln(result);
1, 2, 3
Error
1, 2, 3, 6, 7, 8
123
if (!a[i]) continue;
Skips the defined elements
Skips the existent elements
Skips the null elements
Skips the defined & existent elements
An integer
A String
An object
Floating point
function equalto()
{
int num=10;
if(num===10)
return true;
else
return false;
}
true
false
runtime error
compilation error
function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}
true
false
runtime error
logical error
isarrayType()
==
===
typeof
<script>
var x = 5;
var y = 2;
var z = x % y;
document.getElementById("demo").innerHTML = z;
</script>
0
1
2
5
parse
a sync
defer
type
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
var grand_Total=eval(10*10+5);
10*10+5
105 as a string
105 as an integer value
Exception is thrown
int sum=0;
var arr = [10,15,20,30];
arr.forEach(function myFunction(element)
{
sum= sum+element;
});
document.writeln(sum);
70
75
10
error