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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                 function hello() {
    console.log('Hello', this);
  }

  const person = {
    name:'Andray',
    age:25,
    sayhelloWindow:hello.bind(this),
    logInfo:function() {//this работает в контексте person
      console.group(`${this.name} info:`)
      console.log(`name is ${this.name}`);//name is Andray
      console.log(`age is ${this.age}`);//age is 25
      console.groupEnd();
    }
  }

  // добавим еще объек
  const lena = {
    name:'Elena',
    age:23
  }
  person.logInfo.bind(lena)();

  // теперь мы хотим передавать дополнительные параметры
	
  function hello() {
    console.log('Hello', this);
  }

  const person = {
    name:'Andray',
    age:25,
    sayhelloWindow:hello.bind(this),
    logInfo:function(job,phone) {//this работает в контексте person
      console.group(`${this.name} info:`);
      console.log(`name is ${this.name}`);//name is Andray
      console.log(`age is ${this.age}`);//age is 25
      console.log(`job is ${job}`);//age is 25
      console.log(`phone is ${phone}`);//age is 25
      console.groupEnd();
    }
  };

  // добавим еще объек
	
  const lena = {
    name:'Elena',
    age:23
  };
  const fnLenaInfoLog = person.logInfo.bind(lena,'frontend','+375')();

  // теперь проработаем через call
  const fnLenaInfoLog = person.logInfo.call(lena,'frontend','+375');
  // теперь проработаем через apply
  const fnLenaInfoLog = person.logInfo.call(lena,['frontend','+375']);
  
  
//  example
	
  const array = [1,2,3,4];
  
  function multBy(arr,n) {
    return arr.map(function(elem){
      return elem * n;
    })
  }
  console.log(multBy(array,15));//[15,30,45 60]

//example
	
  const array = [1,2,3,4,5];

  Array.prototype.multBy = function(n) {
    console.log('multBy',this)//multBy[1,2,3,4,5]
  }
  console.log(array.multBy(5));
  
  
  
//  example
	
  const array = [1,2,3,4,5];

  Array.prototype.multBy = function(n) {
    return this.map(function(i) {
      return i * n
    })
  }
  console.log([1,2,3,4,5].multBy(3));[3,6,9,12,15]
  console.log(array.multBy(2));//[2,4,6,8,10]

              
            
!
999px

Console