預設值

預設值

範例一

var obj = { a: 1 };
var list = [ 1 ];
var { a, b = 2 } = obj;
var [ x, y = 2 ] = list;

範例二

ES6

function fnuc(x = 1, y = 2){}

ES5

function fnuc(x, y){
  x = x || 1;
  y = y || 2;
}

results for ""

    No results matching ""