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

              
                // Cú pháp khởi tạo biến và hằng số
let numVar = 1;
let stringVar = 'Hello World!!!';
// numVar += 1; ==> numVar === 2

const numConst = 1;
const stringConst = 'Hello World!!!';
// numConst += 1; ==> error

// Nội suy chuỗi (String Interpolation)
console.log(`Nội suy chuỗi: ${stringVar}`);

function stringInterpolation() {
  return 'stringInterpolation đã được gọi!!!';
}
console.log(`Nội suy chuỗi: ${stringInterpolation()}`);

// Các giá trị mặc định của các tham số trong Function
function defaultParams(a = 1, b = 2) {
  console.log(`Giá trị mặc định: ${a} - ${b}`);
}
defaultParams();

// Function thông thường
function regularFunc() {
  this.hello = 'Hello Regular Function';
  console.log('regularFunc: ' + this.hello);
}
regularFunc();

// Anonymous Function
let anonymousFunc = function() {
  this.hello = 'Hello Anonymous Function';
  console.log('anonymousFunc: ' + this.hello);
}
anonymousFunc();

// Arrow Function
let arrowFunc = () => {
  // this ở đây sẽ không hiểu nếu bạn dùng 'use strict' ở Javascript hoặc khi dùng Babel
  this.hello = 'Hello Arrow Function';
  console.log('arrowFunc: ' + this.hello);
}
arrowFunc();

// Một số cách viết tắt trong Arrow Function
let full = (a = 1 , b = 2) => {
  return a + b;
}
full(); // full === 3
let one = a => a; one(5); // one === 5
let two = (a, b) => a + b; two(1, 2) // two === 3
              
            
!
999px

Console