Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div>
More info on:
<br /><br />
<a href="https://daily-dev-tips.com/posts/javascript-basics-loops/" target="_blank">Daily Dev Tips</a>
<br /><br />
See console for output 🙋
</div>
              
            
!

CSS

              
                body {
  font-family: Roboto,"Helvetica Neue",Arial,sans-serif;
  display: grid;
  place-items: center;
  min-height: 100vh;
  text-align: center;
  font-size: 2rem;
}
              
            
!

JS

              
                <!-- JavaScript for loop -->
console.group('for loop');
for (let i = 0; i < 5; i++) {
  // Execute 5 times
  console.log(`This is loop number ${i}`);
}
console.groupEnd('for loop');

<!-- For array -->
console.group('for array loop');
const foods = ['🍕', '🍗', '🍔', '🌮'];
for (let i = 0; i < foods.length; i++) {
  console.log(foods[i]);
}
console.groupEnd('for array loop');

<!-- forEach loop -->
console.group('foreach');
foods.forEach((item, index) => {
  console.log(`${index}: ${item}`);
});
console.groupEnd('foreach');

<!-- for in -->
console.group('for in');
const user = {
  username: 'DailyDevTips',
  firstName: 'Chris',
  favoriteFood: '🍕'
};

for(let property in user) {
  console.log(`${property}: ${user[property]}`);
}
console.groupEnd('for in');

<!-- For of -->
console.group('for of');
const foods2 = ['🍕', '🍗', '🍔', '🌮'];
for(let value of foods2) {
  console.log(value);
}
console.groupEnd('for of');

<!-- while -->
console.group('while');
let check = false;
while(!check) {
  console.log('not correct');
  check = true;
}
console.groupEnd('while');

console.group('while count');
let amount = 0;
while(amount < 5) {
  console.log(`amount ${amount}`);
  amount++;
}
console.groupEnd('while count');

<!-- Do while -->
console.group('do while');
let test = true;
do {
  console.log('testing');
  test = false;
} while(test);
console.groupEnd('do while');

console.group('do while false');
let test2 = false;
do {
  console.log('testing');
  test2 = false;
} while(test2);
console.groupEnd('do while false');
              
            
!
999px

Console