假设我有一个如下的函数
function addressCombo(street1:string, street2:string = "NA", street3?:string) {
console.log("street1: " + street1);
console.log("street1: " + street2);
console.log("street2: " + street3);
}
如果我想传递参数street1
和street3
的值,但不包括street2
,那我该怎么做呢?
我来自C#
背景,在那里我们会这样做:
addressCombo("ABC", street3 : "XYZ");