2 ms·
function f1(a:number, b:number, c:number, d:number) { [a, b] = [b, a] [c, d] = [d, c] console.log(a, b, c, d) } For the above codes
by theThree 1y ago
function f1(a:number, b:number, c:number, d:number) {
[a, b] = [b, a]
[c, d] = [d, c]
console.log(a, b, c, d)
}
For the above codes Typescript gives error message: Type 'number[]' is not assignable to type 'number'.