JavaScript Loops, Arrays and Objects

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Remove last array item?

'array.push()'

Can you add more than item at a time. If so how?

'array.push(alpha,beta,gamma)'

Adding an item to an array with 'push'?

'array.push(value)'

Removing first array item?

'array.shift()'

Add item to the beginning of an array?

'array.unshift'

Adding an item to an array with '.length' method?

'array[array.length] = value'

Do while loop syntax?

'do{}while()'

What is returned by the JS interpreter if the indexOf() function fails to find a value?

-1

What is a loop?

A method which repeats actions based on a condition.

Object?

A single item that holds multiple variables.

Is JSON initially a object literal or a string?

A string.

JSON definition?

JavaScript Object Notation.

'.shift()'

Removes and returns the first item in an array.

.'length'

Returns the length of the object(number, string, array).

'indexOf()' defined?

Searches an array to see if there is a matching item in the referred array.

'break'

Statement that makes the JavaScript interpreter exit a loop even when the loop condition is true.

Is the value in a for loop argument modified before or after the loop code?

The initial value is modified after the statement in the for loop runs.

What causes an endless loop?

When the condition never evaluates to false.

When should you use loops?

When you want to repeat code over a certain amount of times.

Can you use methods on object values?

Yes

Accessing an object within an array?

array[i].key

'for loop'

for( i = int; i < length; i+=int){}

Object specific for loop syntax?

for(var key in object){ //Code }

Example of indexOf() in use?

indexOf('alpha') returns the index number of the item.

Object value modification?

object.key = 'new value'; or object[key] = 'new value';

Object call?

object.key or object[key]

Array object(s) syntax?

var array = [ {key:value}, {key:value}, {key:value} ];

Object syntax

var object = { key:value, key:value, ... }


संबंधित स्टडी सेट्स

MDA 142 Final Exam (Ch. 48, 49, 54, 55, 56, 57)

View Set

Abeka 5th Grade, Science Quiz 6 (2.8 - 2.9)

View Set

Chapter 40: Nursing Care of the Child With an Alteration in Gas Exchange/Respiratory Disorder

View Set