A short summary of ES6 features and their ES5 equivalents.
Access in-depth ES6 articles here.
Table of contents
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title></title> | |
| <meta http-equiv="Content-Security-Policy" content="default-src https://ajax.googleapis.com; child-src 'none'; object-src 'none';"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <h1>test</h1> | |
| <script> |
| import isString from 'lodash/isString'; | |
| export class Browser { | |
| /** | |
| * Creates an instance of Browser. | |
| * @memberof Browser | |
| */ | |
| constructor() { | |
| this.setClassOnBody(this.detectBrowser()); |
| FROM node:boron | |
| # Create app directory | |
| WORKDIR /usr/src/app | |
| # Install app dependencies | |
| COPY package.json . | |
| # For npm@5 or later, copy package-lock.json as well | |
| # COPY package.json package-lock.json ./ |
| /** | |
| * Class helper | |
| * @param className | |
| * @param method | |
| * @param element | |
| * @returns {*} | |
| * @example curry(classHelper)('myClass')('contains') | |
| * @example curry(classHelper)('myClass')('add') | |
| * @example curry(classHelper)('myClass')('remove') | |
| */ |
A short summary of ES6 features and their ES5 equivalents.
Access in-depth ES6 articles here.
Table of contents
| console[console.info ? 'info' : 'log'] ("Hello world") |
Source repo: xxx
Dev Site: http://example.com
Uat site: http://example.com
| // Will take 1000ms total! | |
| async function series() { | |
| await wait(500); | |
| await wait(500); | |
| return "done!"; | |
| } | |
| // Would take only 500ms total! | |
| async function parallel() { | |
| const wait1 = wait(500); |
Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally, arrows retain the scope of the caller inside the function eliminating the need of self = this.
// const multiply = function(x,y) {
| /** | |
| * @param {boolean} condition | |
| * @param {string} msg | |
| */ | |
| export function assert (condition, msg) { | |
| if (!condition) throw new Error(`[assert error] ${msg}`) | |
| } |