Tenth exercise of javascript