Why is this code not working?

var sctrictname = "Генадий Степаныч"; var coolname = sctrictname.replace("адий Степаныч","ка Рыжий"; alert(coolname); 

Closed due to the fact that off-topic participants are Alexey Shimansky , Grundy , aleksandr barakin , Kromster , pavel 14 May '17 at 13:20 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Alexey Shimansky, Grundy, aleksandr barakin, Kromster, pavel
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Of course. because syntax error. In the console, by the way, it is written - Alexey Shimansky
  • If only because of this, it is good, but in the code the bracket is closed, but it still does not work ... P.S. Example corrected, thank you - CoffeJava
  • Why corrected in the question? Now everything works. Worker code now - Alexey Shimansky
  • Thank. True, I will be more attentive. - CoffeJava

1 answer 1

We know, the replace function is not closed with a bracket.

 var sctrictname = "Генадий Степаныч"; var coolname = sctrictname.replace("адий Степаныч","ка Рыжий"); console.log(coolname);