Passing long parameters in a constructor function

hello

how can I pass long parameters inside a function constructor? a parameter with white space in it.

I tried something like that:

  var person = function(name,["last name"]){
             this.name = name,
                 this["last name"]= ["last name"]
         }

is there a way to do that? or last name have to be one word - lastname

Variables can’t have spaces. Please read about variable naming rules and conventions in Javascript.

1 Like

So you basically want to have a variable / parameter with a space in it? That is definitely not possible (as @yasserhussain1110 just mentioned) . It is best to use camelCase: lastName.

1 Like