Understand major concepts in docker in 10 minutes

The Neuschwanstein castle, Germany
  1. Resources consumption
    Virtual machine have their own OS, it is a computer inside computer, while docker share the same kernal with the host OS. As a result, virtual machine requires more resources than docker.
  2. Infrastructure as code
    Docker image are…

Spiss Castle, Slovakia
  1. reduce()
Example 1let numbers = [1, 2, 3, 4, 5];let result = numbers.reduce(sum);//total - the value of last result
//At the beginning, the total is 1 - 1st element in array,
//and num is 2 - 2nd element array
//Then the value of total will be 1 + 2 = 3,
//and num will be 3 - 3rd element array
//Then the value of total…

1. callbacks

//simple callbacks exampleconst greetings = () => {
const greetingsLater = () => {
setTimeout(greetingsLater, 5000);

  1. Detected changes in props or state
  2. Trigger shouldComponentUpdate(), by default return true, that means it always go to the next step render()
  3. render() is called to render the new virtual DOM
  4. Compare the old virtual DOM with the newly rendered virtual DOM
  5. Update the real DOM if any difference found, only update the parts which are different instead of the whole DOM

What is state?

The Library of Trinity College
  1. More about Promise
  • Promise.resolve()
Promise.resolve("finished").then(data=> {console.log(data)})//output
  • Promise.reject()
//Promisfied setTimeout
const delay = (msg, ms) => new Promise(resolve => setTimeout(
() => resolve(msg)…

let car = {type:"Tesla", model:"Modal X", color:"white"};//In Javascript, objects can contains function
let car = {…

  1. Class

Johnny Lai

Self-taught programmer locating in New Zealand.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store