Skip to content Skip to sidebar Skip to footer

How To Pass This Variable To This Function?

I have to pass aaa to ehi() function in the mitt parameter. aaa is an array of numbers like: 29837,127365,5645,12323,47656564,2312,4534,2343 This is the correct way that the ehi()

Solution 1:

Array's has a join() method which calls the toString() of each element and concatates them with the joiner specified.

love({functionality: 'kiss',
      mess: 'yuhuuuuuu',
      mitt: aaa.join(",")
});

Solution 2:

Your Question is not clear enough, does your mitt need a string or an array?

If aaa already is a real array ( aaa = [...] // typeof(aaa) === "object" ) and mitt needs a String, then take the following:

mitt: aaa.join(',')

if your mitt needs an Array simply do:

mitt: aaa

However, if aaa is a string, do the either:

mitt: aaa.split(',') //<- passes an array to mitt

or

mitt: aaa // <- passes aaa as a string to mitt

Solution 3:

love({functionality: 'kiss',
        mess: 'yuhuuuuuu',
        mitt: aaa.join(',')
  });

Solution 4:

Try the following

 love({functionality: 'kiss',
        mess: 'yuhuuuuuu',
        mitt: aaa
  });

Post a Comment for "How To Pass This Variable To This Function?"