Flashcards
HTML5 CSS3 Javascript Microsoft Exam Chap 2
Cards in this deck (11)
- 1What's the difference between == and === ?== (equality) depends on the value
=== (identity) depends on the value and the data type - 2What happens if you try to access the 10th element of an array initially declared to have 5 elements?As sizing array is very dynamic, the array will automatically resize to accomodate the requested length.
- 3What does the "concat" method on an array?it combines two arrays and returns all the elements from both the arrays.
ex : array1.concat(array2); - 4What do the indexOf and lastIndexOf methods on an array?it determines the index of an element searching in an ascending order or descending order (if lastIndexOf).
It accepts 2 parameters, the element and the index at wich to begin searching.
ex : var index = array1.indexOf('array2', 0); - 5What does the join method on an array?it joins all the elements in an array into a single string separated by a specified string separator.
ex : var join = array1.join('-'); - 6What does the reverse method on an array?it reverses the sequence of all elements in an array.
ex : var numbers = new Array('1','2','3');
numbers.reverse() will give an Array('3','2','1').
It does not return anything - 7What does the sort method on an array?it sequences the items in an array in ascending order. It does not return anything
- 8What does the slice method on an array?it takes out one or more items in an array and move them to a new array.
ex : var num = new Array('1','2','3');
var num2 = num.slice(0, 1); will give a num2 containing only the number 1. - 9What does the splice method on an array?it provides a way to replace items in an array with new items.
ex : var num = new Array('1','2','3');
var num2 = num.splice(1,2,'4'); will give a num2 containing 1, 4 and 3 - 10What do push and pop method on an array?They add and remove the last item of a list. pop returns the item removed.
As if the array was a stack. - 11What do shift and unshift method on an array?shift remove and return the first element of an array. unshift insert a new element at the beginning of the array.
Information
- Description
- Information Technology Flashcards on HTML5 CSS3 Javascript Microsoft Exam Chap 2, created by Alexandre Petit on 09/06/2018.
- Created by
- Alexandre Petit
- Views
- 12
- Rating