const object1 = {
property1: 20
};
console.log(Object.is(object1));
20
true
false
error
C. false
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
function printArray(a)
{
var len = a.length, i = 0;
if (len == 0)
console.log(Empty Array);
else
{
do
{
console.log(a[i]);
} while (++i < len);
}
}
Prints the numbers in the array in order
Prints the numbers in the array in the reverse order
Prints 0 to the length of the array
Prints Empty Array
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
function f(o)
{
if (o === undefined) debugger;
}
It does nothing but a simple breakpoint
It debugs the error in that statement and restarts the statements execution
It is used as a keyword that debugs the entire program at once
It is used to find error in the statement
o = {x:1, y:{z:[false,null,]}};
s = JSON.stringify(o);
p = JSON.parse(s);
Object Encapsulation
Object Serialization
Object Abstraction
Object Encoding
Function prototype
Function literal
Function calling
Function declaration
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
Primary expression
Functional expression
Invocation expression
Property Access Expression
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 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
make all of the own properties of that object non configurable
to configure and bring a writable property
lock down objects into a known state and prevent outside tampering
to include new properties into the object
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
var person =
{
name: Rahul,
getName: function()
{
nreturn this.name;
}
}
var unboundName = person.getName;
var boundName = unboundName.bind(person);
document.writeln(boundName());
runtime error;
compilation error
Rahul
undefined
if(a!=null)
if (!a)
if(a!null)
if(a!==null)
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 string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
var o = new Object();
var o = Object();
var o;
var o= new Object;
Object o=new Object();
Floating numbers
Representation of functions that returns a value
is not present in JavaScript
Form feed
function f(o)
{
if (o === undefined) debugger;
}
It does nothing but a simple breakpoint
It debugs the error in that statement and restarts the statements execution
It is used as a keyword that debugs the entire program at once
It is used to find error in the statement
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);
5
555
3
error
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
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
var count = [1,,3];
The omitted value takes undefined
This results in an error
This results in an exception
The omitted value takes an integer value
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
Procedures
Method
Static function
Dynamic function
switch(expression)
{
statements
}
==
equals
equal
===
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
Keywords
Declaration statements
Data types
Prototypes