Echo exercise in Javascript