Fourth exercise of javascript