WEEK 12 Flashcards

1
Q

The ___ are used to iterate the piece of code using for, while, do while or for-in loops. It makes the code compact. It is mostly
used in array.

A

JavaScript loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

There are four types of loops in JavaScript.

A
  • for loop
  • while loop
  • do-while loop
  • for-in loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The ___ iterates the elements for the fixed number of times. It
should be used if number of iteration is known.

A

JavaScript for loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The ___ iterates the elements for the infinite number of times. It should be used if number of iteration is not known.

A

JavaScript while loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

It iterates the elements for the infinite number of times like while loop. But, code is executed at least once whether condition is
true or false.

A

JavaScript do while loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

___ are used to perform operations. We can call JavaScript
function many times to reuse the code.

A

JavaScript Functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Advantage of JavaScript function

A
  1. Code reusability
  2. Less coding
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

We can call a function several times so it save coding.

A

Code reusability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

It makes our program compact. We don’t need to write many
lines of code each time to perform a common task.

A

Less coding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

We can call function by passing arguments.

A

JavaScript Function Arguments -

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

We can call function that returns a value and use
it in our program.

A

Function with Return Value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In JavaScript, the purpose of Function constructor is to create a new Function object. It executes the code globally.
However, if we call the constructor directly, a function is created dynamically but in an unsecured way.

A

JavaScript Function Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

It represents the function definition.

A

functionBody

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

It is used to call a function contains this value and a single array of arguments

A

apply ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

It is used to create a new function.

A

bind()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

It is used to call a function contains this value and an argument list

A

call()

17
Q

It returns the result in form of a string

A

toString

18
Q

___ is an object that represents a collection of
similar type of elements.

A

JavaScript Array -

18
Q

There are 3 ways to construct array in JavaScript

A
  1. JavaScript array literal
  2. JavaScript Array directly (new keyword)
  3. JavaScript array constructor (new keyword) -
19
Q

The syntax of creating array using array literal is
given as:

var arrayname=[value1,value2…..valueN];

As you can see, values are contained inside [ ] and separated by , (comma).

A

JavaScript array literal

20
Q

var arrayname=new Array();

A

JavaScript Array directly (new keyword)

21
Q

You need to create instance of array by passing arguments in constructor so that we don’t have to provide value explicitly.

A

JavaScript array constructor (new keyword)