Save
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.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
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

JavaScript Methods

method syntax and what they return

TermDefinition
.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.
Created by: samanthadegges
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards