Ninth exercise of javascript