Object-Oriented
High-level
Assembly-language
Object-Based
D. Object-Based
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
filter and fold
inject and fold
finger and fold
fold
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]
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
The property will be stored in a cache
The loop will not run
That property will not be enumerated
The property will be enumerated
Floating numbers
Representation of functions that returns a value
is not present in JavaScript
Form feed
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);
}
int a=0;
for(a;a<5;a++);
console.log(a);
0
error
4
5
o(x,y);
o.m(x) && o.m(y);
m(x,y);
o.m(x,y);
if (!a[i]) continue;
Skips the defined elements
Skips the existent elements
Skips the null elements
Skips the defined & existent elements
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
1
2
3
error
int a==2;
int b=4;
int ans=a+b;
print(ans);
2
6
0
error
prototype stack
prototype chain
prototype class
prototypes
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
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
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
if(a!=null)
if (!a)
if(a!null)
if(a!==null)
Create linkage between client side and server side
Permit server side, JavaScript code, to connect to RDBMS
Support only non relational database
To interpret JavaScript code
debugger
with
if
use strict
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 text = testing: 1, 2, 3; // Sample text
var pattern = /d+/g // Matches all instances of one or more digits
text==pattern
text.equals(pattern)
text.test(pattern)
pattern.test(text)
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
var book = {
main title: JavaScript,
'sub-title': The Definitive Guide,
for: all audiences,
author: {
firstname: David,
surname: Flanagan
}
};
properties
property values
property names
objects
const object1 = {};
a = Symbol('a');
b = Symbol.for('b');
object1[a] = 'harry';
object1[b] = 'derry';
const objectSymbols = Object.getOwnPropertySymbols(object1);
console.log(objectSymbols.length);
0
2
1
Error
int a=1;
if(a!=null)
return 1;
else
return 0;
1
0
runtime error
compiler error
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
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation
function equalto()
{
int num=10;
if(num===10)
return true;
else
return false;
}
true
false
runtime error
compilation error
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