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));
A.
x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));
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
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
var book = {
main title: JavaScript,
'sub-title': The Definitive Guide,
for: all audiences,
author: {
firstname: David,
surname: Flanagan
}
};
properties
property values
property names
objects
directly into JS file and included into HTML
directly on the server page
directly into HTML pages
directly into the css file
Primary expression
Functional expression
Invocation expression
Property Access Expression
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
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
[digits][.digits][(E|e)[(+|-)]digits]
[digits][+digits][(E|e)[(+|-)]digits]
[digits][(E|e)[(+|-)]digits]
[.digits][digits][(E|e)[(+|-)]digits]
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
the head tag
the head or body
the title or head
after the body tag
var tensquared = (function(x) {return x*x;}(10));
Yes, perfectly
Error
Exception will be thrown
Memory leak
decrements the total length by 1
increments the total length by 1
prints the first element but no effect on the length
updates the element
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
10
Error
1
5
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
for(var p in o)
console.log(o[p]);
for (var i = 0;i < a.length;i++)
console.log(a[i]);
for (int i = 0;i < a.length;i++)
console.log(a[i]);
for (var i = 0;i <= a.length;i++)
console.log(a[i]);
for (var i = 1;i < a.length;i++)
console.log(a[i]);
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
Keywords
Declaration statements
Data types
Prototypes
int sum=0;
var arr = [10,15,20,30];
arr.forEach(function myFunction(element)
{
sum= sum+element;
});
document.writeln(sum);
70
75
10
error
in
exist
within
exists
var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
Function prototype
Function literal
Function calling
Function declaration
var txt1 = good;
var txt2 = day;
document.getElementById(demo).innerHTML = txt1 + txt2;
good day
goodday
error
undefined
RMI
Triggering Event
Preprocessor
Function/Method
Volatile variable
Mutable variable
Immutable variable
Dynamic variable
Procedures
Method
Static function
Dynamic function
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2
true false
false true
true true
false true
src
ext
script
link
var grade='B';
var result;
switch(grade)
{
case 'A':
{
result+=10;
break;
}
case 'B':
{
result+= 9;
break;
}
case 'C':
{
result+= 8;
break;
}
default:
result+= 0;
}
document.write(result);
10
9
8
0