o = {x:1, y:{z:[false,null,]}};
s = JSON.stringify(o);
p = JSON.parse(s);
Object Encapsulation
Object Serialization
Object Abstraction
Object Encoding
B. Object Serialization
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
Keywords
Declaration statements
Data types
Prototypes
isarrayType()
==
===
typeof
int a==2;
int b=4;
int ans=a+b;
print(ans);
2
6
0
error
If the object inherits enumerable properties
The object does not have the properties present in the integer array indices
The delete keyword is never used
Object.defineProperty() is not used
o.m(x) && o.m(y);
o[m](x,y);
o(m)[x,y];
o.m(x && y);
isPrototypeOf() method
equals() method
=== operator
==opertor
var arr = [7, 5, 9, 1];
var min = Math.min.apply(null, arr);
document.writeln(min);
7
5
1
9
var a = 10;
do {
a += 1;
console.log(a);
} while (a < 5);
11121314
1112
12345
11
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
No, this will throw an exception as only numerics can be used in a for loop
No, this will not iterate
Yes, this will work
No, this will result in a runtime error with the message Cannot use Linked List
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
maps the elements of another array into itself
passes each element of the array and returns the necessary mapped elements
passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function
pass the elements of the array into another array
00
0x
0X
Both 0x and 0X
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);
}
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
An integer
A String
An object
Floating point
7.25
-7.25
7
-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
High level programming language
Assembly level programming language
Machine level programming language
Low level programming language
switch(expression)
{
statements
}
==
equals
equal
===
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
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
false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)
var txt1 = good;
var txt2 = day;
document.getElementById(demo).innerHTML = txt1 + txt2;
good day
goodday
error
undefined
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
if(a!=null)
if (!a)
if(a!null)
if(a!==null)
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
void
int
function
main