Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


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.
We do not share your email address with others. It is only used to allow you to reset your password. For details read 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.

Remove ads
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards




share
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