Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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.


Auto Save

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.



<p>A simple demo of the <code>Promise.allSettled()</code> method.</p>

<p>Check the console!</p>

  <a href="">View the blog post</a>.    


                * {
  box-sizing: border-box;

body {
  width: 88%;
  max-width: 30em;
  margin: 1em auto;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: #fff;
  color: #000;

a {
  color: #068;

code {
  font-family: Menlo, Monaco, 'Courier New', monospace;

p code {
  color: #dd4a68;

@media (prefers-color-scheme: dark) {
  body {
    background: #222;
    color: #fff;

  a {
    color: #00bfff;

  p code {
    color: #ff5578; 


                const api = '';

// The last endpoint will fail; it should be 'albums'
const endpoints = ['posts', 'comments', 'albutts'];

function getJSON(response) {
  if (response.ok) return response.json();

  const { status } = response;
  const error = new Error(status.toString(10));

  return Promise.reject(error);

async function getData(endpoint) {
  const response = await fetch(`${api}/${endpoint}/1`);
  return getJSON(response);

function isFulfilled(result) {
  return result.status === 'fulfilled';

const data =;

Promise.allSettled(data).then(results => {
  console.log('All results:', results);
  console.log('Fulfilled results:', results.filter(isFulfilled));