1. 程式人生 > >stage-0,雜(1)

stage-0,雜(1)

迫不及待的嘗試新特性,亂七八糟的入門demo

 https://www.babeljs.cn/repl/#?babili=false&browsers=&build=&builtIns=false&code_lz=MYewdgzgLgBARiAHjAvDA3gKAJAHcCmAlgOYAWUAXDAEwA0Ox-UA6kWVABQCUGMATkwCufMDCilCEAHQES5ANwwAvvSXzMmUJFjoYjFm3LLU8JOswJEFCvtZzOXeQHongSW9A73KA4uUtTbhhxqYAGaCYMBQhOAwAIYAJrEcAG7RADY8ugJQwqLikjAA1DDJKYpKGloQICn4UikgxByW1n723NZxCQCsXI4uAOxAA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&lineWrap=true&presets=es2015%2Cstage-0&prettier=false&targets=&version=6.26.0&envVersion=

const box = {
	weight: 2,
	getWeight() { return this.weight; },
};

const { getWeight } = box;

box::getWeight();//等價於box.getWeight()


function add(val) { return this + val; }

console.log(box::getWeight()::add(5));//7