finish code of cookie.js