原创 $@ and $*

$@ expanded as “$1” “$2” “$3” … “$n” $* expanded as “$1y$2y$3y…$n”, where y is the value of $IFS variable i.e. “$*”

原创 SpringJPA 簡單應用

在application.properties 裏面聲明 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect spri

原创 js設計模式----Behavioral Patterns之Interpreter(3)

This pattern is different from those we’ve seen to this point as there is no real class structure that is defined by t

原创 js設計模式----創建者模式(1)Singleton

let Westros; (function (Westros) { var Wall = (function () { function Wall() { this.height = 0

原创 js設計模式之Structural Patterns------Adapter(1)

The interface of the implementation does not look the way we would like it to for use in our code. Normally the solu

原创 js設計模式----創建者模式(1)抽象工廠模式

1)抽象工廠模式 JavaScript 的動態性質 排除了描述類的需要接口。 Instead of interfaces, JavaScript trusts that the class you provide implemen

原创 js設計模式----創建者模式(1)Builder

In our fictional world we sometimes have some rather complicated classes, which need to be constructed. The classes co

原创 js----modules2(用原文是翻譯詞不達意)

用 IIEF 來創建簡單的繼承結構: let Castle = (function () { function Castle(name) { this.name = name; } Castle.p

原创 js設計模式----Behavioral Patterns之責任鏈(1)

The chain of responsibility pattern describes an approach in which a message tickles down from one class to another. A

原创 js設計模式----Behavioral Patterns之Iterator(4)

class KingSuccession { constructor(inLineForThrone){ this.inLineForThrone = inLineForThrone; this.p

原创 Loops and closures

for (var i=1; i<=5; i++) { setTimeout( function delay(){ console.log( i ); }, i*100); } 輸出是? The i variable is

原创 js -------------let var hoisting

ES6 引入的 let 用來聲明 塊範圍(block scope)for( var i = 0; i < 10; i++){console.log(i);};console.log(i); 替換 var  成 let  感受一下 區別。下

原创 Scope變量衝突以及 IIEF

function foo() { function bar(a) { i =8;//這邊聲明衝突 console.log(a+i); } for (var i =0 ;i<10;

原创 js設計模式之Structural Patterns------Bridge(2)

The bridge pattern takes the adapter pattern to a new level. Given an interface, we can build multiple adapters, each

原创 js設計模式----Behavioral Patterns之Mediator(5)

In this example we’ll greatly simplify the communication between the houses and say that all messages pass through t