Return multiple variables from a JavaScript function?

后端 未结 2 1408
囚心锁ツ
囚心锁ツ 2021-02-01 06:10

In python, to return multiple variables, I can do --

def function_one(i):
    return int(i), int(i) * 2

value, duble_value = function_one(1)

H

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 06:26

    function foo(){
        return ["something","something else","something more","something further"];
    }
    
    let [a,b,c,d] = foo();
    

提交回复
热议问题