I have defined my JavaScript function as follows:
function printCompanyName(company1, company2, company3, company4, company5)
{
document.write("<p>" + company1 + "</p>");
document.write("<p>" + company2 + "</p>");
document.write("<p>" + company3 + "</p>");
document.write("<p>" + company4 + "</p>");
document.write("<p>" + company5 + "</p>");
}
And called it as follows:
printCompanyName("Dell, Microsoft, Apple, Gizmodo, Amazon");
But I get the following output:
Dell, Microsoft, Apple, Gizmodo, Amazon
undefined
undefined
undefined
undefined
What gives!? I have been trying to figure this out for hrs. I want:
Dell
Microsoft
Apple
Gizmodo
Amazon