DEV Community

Ugboma
Ugboma

Posted on

JavaScript Tips💡

Instead of writing:
text += bike[0] + "
";
text += bike[1] + "
";
text += bike[2] + "
";
text += bike[3] + "
";
text += bike[4] + "
";

You can write:
for (let i = 0; i < bike.length; i++) {
text += cars[i] + "
";
}

Top comments (4)

Collapse
 
mellen profile image
Matt Ellen

The alt text just says "image description". what is in the image?

Collapse
 
ugboma profile image
Ugboma

so sorry
i would correct that now so sorry

Collapse
 
mellen profile image
Matt Ellen

Thanks!

Collapse
 
frankwisniewski profile image
Frank Wisniewski

cars <> bike