css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <p style="text-align:left;">If this demo has brought you even a modicum of joy, please consider <a href="https://www.paypal.me/RobertGravelle/1" target="_blank">donating $1 dollar</a> (secure PayPal link) for a coffee or purchasing one of my songs from <a href="https://ax.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=rob%20gravelle" target="_blank">iTunes.com</a> or <a href="http://www.amazon.com/s/ref=ntt_srch_drd_B001ES9TTK?ie=UTF8&field-keywords=Rob%20Gravelle&index=digital-music&search-type=ss" target="_blank">Amazon.com</a> for only 0.99 cents each.</p>
<p style="text-align:left;">Rob uses and recommends <a href="http://www.mochahost.com/2425.html" target="_blank">MochaHost</a>, which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!</p>

<p>Pssst: Open the console to view the results.</p>
              var menuData = [
  'French Butter Croissant',
  'Our croissants have all the flavour and lightness of a classic French croissant.',
  'There are three different types of our Pretzel (plain, poppy seeds or sesame).',
  'Free-Range Egg Mayo & Roasted Tomato Breakfast Baguette',
  'Chunky egg mayonnaise and roasted tomatoes are a great breakfast combination.',
  'Five Berry Pot',
  'A simple little pot; very berry compote topped with natural yoghurt.',

Array.prototype.arraySplitReverse = function(pattern, removeMatchedElements){
  var arr = this, retval = [], i = arr.length; 
  while ( --i ) {
    if (typeof(arr[i]) === 'string' && pattern.test(arr[i])) {
      //remove all elements up till end of array
      var tmpArray = arr.splice(i);
      //remove first (matched) element from temp array
      if (removeMatchedElements === true) tmpArray.shift();
      //add the temp array to the start of the new array
      //as a 2nd dimension
      //reset i
      i = arr.length;
  return retval.length > 0 ? retval : arr;

console.log( menuData.arraySplitReverse(/^(https?:\/)?\/\S+\.(?:jpg|png|gif)$/i) );

console.log( menuData.arraySplitReverse(/^(https?:\/)?\/\S+\.(?:jpg|png|gif)$/i, true) );

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................