Skip to content
Advertisement

In for each loop i want to skip “, ” in last iteration

I want to skip printing “, ” in last iteration.

I want output like name, name, name

Output now i am getting is name, name, name,

JavaScript

Advertisement

Answer

You can append the comma before you append the name. Like this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement