Pen Settings



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


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.


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.






                // 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}`);

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

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

// 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);

// 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