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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /**
 * Diese Funktionen kann man küzer schreiben
 * https://www.w3schools.com/js/js_arrow_function.asp
 */

const hello1 = function(val) {    // val ist ein Parameter
  return "Hello1 World! " + val;          // return ist =>
}
console.log(`hello1: ${hello1('John')}`); // hello1: Hello1 World! John

const hello2 = (val) => {
  return "Hello2 World! " + val;
}
console.log(`hello2: ${hello2('John')}`);  // hello2: Hello2 World! John

/** If you have parameters, you pass them inside the parentheses */
const hello3 = (val) => "Hello3 World! " + val;
console.log(`hello3: ${hello3('John')}`); // hello3: Hello3 World! John

/** In fact, if you have only one parameter, you can skip the parentheses as well */
const hello4 = val => "Hello4 World! " + val;
console.log(`hello4: ${hello4('John')}`); // hello4: Hello4 World! John

const hello5 = () => "Hello5 World!";
console.log(`hello5: ${hello5('John')}`);

const obst = [ 
  'Banane',
  'Apfel',
  'Pfirisch'
];

const hello6 = obst => obst.some(checkLength); // val ist ein Parameter und => bedeutet return
console.log(`hello6: ${hello6(obst)}`);    // true

function checkLength(obst) {
  return obst.length >= 5;
}

/**
 * Beispiel some()
 */
// let value = 'Apfel';

// const arrInclude = [ 
//   'Banane',
//   'Apfel',
//   'Pfirisch'
// ];

// const even = (element) => element === value;

// if(arrInclude.some(even)){
//   console.log('Treffer!');
// }
// else{
//   console.log('Kein Treffer!');
// }


/** 
 * Filter()
 * Hiermit bekomme ich alle Array Elemente aus arrMovies, wo in Genre "Abenteuer" enthalten ist.
 */

// const arrMovies = [
//   {
//     Titel: 'Prometheus',
//     Genre: 'Science-Fiction,Fantasy',
//     Tags: 'Favorit,Weltall'
//   },
//   {
//     Titel: 'Arrival',
//     Genre: 'Science-Fiction,Fantasy',
//     Tags: 'Weltall'
//   },
//   {
//     Titel: 'Pirates of the Caribbean Salazars Rache',
//     Genre: 'Abenteuer,Fantasy',
//     Tags: 'Piraten,Meer'
//   },
//   {
//     Titel: 'Shutter Island',
//     Genre: 'Drama,Thriller',
//     Tags: 'Favorit,De Caprio'
//   }  
  
// ];

// /** Das ist die ausführliche Schreibweise */
// let dataset = arrMovies.filter(function(movie){
//   if(movie['Genre'].includes('Abenteuer')){
//      return true;
//   }
// });

/** Das ist die kurze Schreibweise */
// let dataset = arrMovies.filter(movie => movie['Genre'].includes('Abenteuer') === true);



/**
 * Eine etwas mehr verschachtelte Schreibweise
 * Der Code ist nicht vollständig, es fehlen u.a. Arrays. Es geht nur um die verkürtze und ausführliche Schreibweise
 */

/** Kurze Schreibweise */
// return movie => genresToFind.some(genre => movie.genres.includes(genre));

/** Ausführliche Schreibweise */
// let dataset2 = function(movie){
//     if (genresToFind.some(
//             function(genre) {
//                 if(movie.genres.includes(genre)) {
//                     return true;
//                 } else {
//                     return false;
//                 }
//             }
//         )
//     )
//     {
//         return true;
//     } 
//     else 
//     {
//         return false;
//     }
// }

// console.log(`dataset2: ${dataset2}`);

              
            
!
999px

Console