More than one paramerter - problem

0 Nikolai Illyich · September 1, 2015
I don't get this. I try to make a function that prints text with only one parameter everything works. I add a second parameter and suddenly it doesn't work. Anyone know how to fix this?

Here's the code:

 function apples(one, two){
  document.write(one + " is the best before " two);
 apples("bucky", "coding");

Could it be an issue with chrome? Tried it on Moz. Didn't work.

 function apples(one, two){
  document.write(" " + two);
 apples("bucky", "apples");

This way makes it work, but is inconvenient due to its length and will take more time.

Post a Reply


Oldest  Newest  Rating
0 Anastasiia Zhenevskaia · September 4, 2015
You might want to use another "+" to concatenate second parameter to the string.
function apples(one, two){
  document.write(one + " is the best before " + two);
 apples("bucky", "coding"); 

This worked for me.
0 Nikolai Illyich · September 11, 2015
Oh! I can't believe I didn't see through that xD
I completely forgot to add the other plus sign... now that I look back on it, it looks completely off. Thanks Anastasiia.
  • 1



A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.