Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>JS Array Methods</h1>

<p><strong>map</strong> - returns an array based on the arguments that you provide inside the map</p>

<p><strong>foreach</strong> - loop through all of the array elements</p>

<p><strong>every</strong> - returns a boolean - true if every element in this array satisfies the provided testing function</p>

<p><strong>some</strong> - returns a boolean - returns true if the callback function returns true for any array element; otherwise, false.</p>

<p><strong>filter</strong> - returns an array based on the arguments that were true when looping</p>

<p><strong>reduce</strong> - returns a value, takes the prev/next item int he array and can do what want with them in function, useful for summing the contents of array</p>

<p><strong>reduceRight</strong> - as above but starts at end goes backwards</p>




                // Sample arrays
var arrPeople = [
    'name': 'Shane',
    'age': 29
    'name': 'James',
    'age': 35
    'name': 'Ro',
    'age': 28
    'name': 'Jordan',
    'age': 21
    'name': 'Luc',
    'age': 18

// Map {
  return 'My name is ' + + '. I am ' + obj.age + ' years of age.'

// forEach
arrPeople.forEach(function(obj) {

// every
arrPeople.every(function(obj) {
  return obj.age < 25;

// some
arrPeople.some(function(obj) {
  return === 'Shaney';

// Filter
arrPeople.filter(function(obj) {
  return obj.age < 30;

// Reduce 
arrPeople.reduce(function(a, b) {
  if(a.age < b.age) return a
  else return b

// Reduce 
arrPeople.reduceRight(function(a, b) {
  return b * a;