D
D
Dima_Demichev2018-03-24 09:34:13
JavaScript
Dima_Demichev, 2018-03-24 09:34:13

How to pass an array to a function?

I started learning node.js and then a question came up, because I'm not very good with regular js either. How can I pass an array like this to a function:

var mass = {
  a: "",
  b: ""
};

function func(){
mass = {
  a: "a",
  b: "b"
};
}

Should be something like
func(mass.a, mass.b);Or how is it done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Simonov, 2018-03-24
@Dima_Demichev

function func(arr){
 //
}

func(['1', '2']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question