Code written in JavaScript

The solution of the request resolved