combining javascript variables into an array -


I know this is a simple question, but I am new and I can not understand it. I am trying to combine two variables into one array. I want to add var word1 and var word2 to create var new 1. What is the proper way to do this?

  var word1 = 'hello' var word 2 = 'good' var newArray = ['hello', 'good']    

You can use, do:

  var word1 = 'hello'; Var word2 = 'good'; Var arr = []; Arr.push (word1, word2); Console.log (arrive); // ["Hello", "Good"]    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -