Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

method syntax and what they return

Quiz yourself by thinking what should be in each of the black spaces below before clicking on it to display the answer.
        Help!  

Term
Definition
.filter()   array.filter(callback) { do whatever }) The filter function iterates over each element of an array and returns just the ones that result true.  
🗑
.test()   tests a string for a match and returns true or false. Takes one argument: either a string or RegEx. RegExHere.test(string);  
🗑
.map()   array.map(function(current, index, array) { code here can include this }); Map() provides a callback function once for each element in an array, in order. It returns a new array from results.  
🗑
.push()   Adds new elements to the end of an array and returns the new LENGTH. Therefore, its ideal to declare the array to be pushed to, globally. syntax: arr.push(any_variable_name)  
🗑
.pop()   Pops the last value of an array and returns that array. Accepts no arg. syntax: arr.pop();  
🗑
shift()   Shift removes the first element of an array. Shift returns the item that was shifted out. Accepts no arg. syntax: arr.shift();  
🗑
.splice()   Splice changes the array it operates on and returns that array. syntax: array.splice(index, toRemove, "what to add here"); Ex: var fruits = ["apple", "kiwi", "orange", "pear"]; return fruits.splice(0, 1, "opossum");  
🗑
join()   array.join(); Makes an array a string by joining all the pieces and inserting the separator. Separator is an optional argument. Join() returns the string it creates.  
🗑
concat()   arr1.concat(arr2, arr3Optional); Joins two or more arrays. Returns a copy of the joined arrays.  
🗑
.map()   array.map(function(current, index, array) { code here can include this }); Map() provides a callback function once for each element in an array, in order. It returns a new array from results.  
🗑
unshift()   Unshift adds a new element to an array at the beginning and unshifts older elements. It returns the new array length.  
🗑
the javascript operator, delete   This is a operator that is used to delete items from an array by changing their value to undefined, which is falsey. Best to use pop() or shift() syntax: delete array[index]  
🗑
.reverse()   Reverses the items in an array and returns the same array, reversed. arr.reverse();  
🗑
.sort()   Sorts an array of string by default, alphabetically. Otherwise sort() takes a compare function such as: array.sort(function(a,b){return a-b)}; Use to find highest or lowest value.  
🗑
.slice()   Slice slices a piece of an array and returns it in a new array. syntax: var arrayOfSlices = originalArr.slice(0, 2); This method ends at but does not include the second index argument.  
🗑
typeof   typeof is a Javascript operator that returns the object type. syntax: typeof example_item;  
🗑
.reduce()   syntax: arr.reduce(callback(prev, current, index, array) {...this..}optInitialvalue); Reduce is a iterator function that applies a function against an accumulator and each value of the array, to reduce it to a single value.  
🗑


   

Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
 
To hide a column, click on the column name.
 
To hide the entire table, click on the "Hide All" button.
 
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
 
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.

 
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how
Created by: samanthadegges
Popular Computers sets