[JavaScript] functional practice