function output(object)
{
var place=object ? object.place : Italy;
return clean:+ place;
}
console.log(output({place:India}));
clean:India
clean:Italy
error
undefined
A. clean:India
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;
x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));
x = a?b:(c?d:(e?f:g));
q = ~(-y); w = (x = (y = z));
x = (x = (y = z));w = ~(-y);
q = a?b:(c?d:(e?f:g));
x = ~(-y); w = (x = (y = z));
q = (c?d:(e?f:g));
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 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 height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
o = {x:1, y:{z:[false,null,]}};
s = JSON.stringify(o);
p = JSON.parse(s);
Object Encapsulation
Object Serialization
Object Abstraction
Object Encoding
function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}
true
false
runtime error
logical error
var arr = [7, 5, 9, 1];
var min = Math.min.apply(null, arr);
document.writeln(min);
7
5
1
9
var txt1 = good;
var txt2 = day;
document.getElementById(demo).innerHTML = txt1 + txt2;
good day
goodday
error
undefined
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
<script>
txt1 = “ one”;
txt1 += “two”;
document.getElementById("demo").innerHTML = txt1;
</script>
onetwo
one two
error
undefined
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
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}
The continue keyword restarts the loop
The continue keyword skips the next iteration
The continue keyword skips the rest of the statements in that iteration
The continue keyword breaks out of the loop
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
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
RMI
Triggering Event
Preprocessor
Function/Method
string a = hi;
string b =there;
alert(a+b);
hi
there
hithere
undefined
RMI
Triggering Event
Preprocessor
Function/Method
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
filter and fold
inject and fold
finger and fold
fold
switch(expression)
{
statements
}
==
equals
equal
===
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
1
0
Null
Undefined
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
continue statement
break statement
goto statement
return statement
var a = [1,2,3,4,5];
a.slice(0,3);
Returns [1,2,3]
Returns [4,5]
Returns [1,2,3,4]
Returns [1,2,3,4,5]
return a localised object representation
return a parsed string
return a local time in the string format
return a localized string representation of the object
void
int
function
main
directly into JS file and included into HTML
directly on the server page
directly into HTML pages
directly into the css file
const object1 = {
property1: 20
};
console.log(Object.is(object1));
20
true
false
error
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
stand-alone expressions
basic expressions containing all necessary functions
contains variable references alone
contains only keywords