Skip to content
Advertisement

Text Editor JavaScript issue with additional comma’s

The code below takes input with a command and then appends it to the array. The result should show the history as if you kept typing and added it. I’m running into an issue where their extra comma appears right after the Hey on the 3rd iteration of the array and not 100% sure why that happens, I was able to remove some of the under commas by replacing but I’m not sure that right approach in this case.

JavaScript

output:

JavaScript

Expected:

JavaScript

Advertisement

Answer

JavaScript

just join your history 🙂

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