Nodejs uses cookie-parser to transmit cookie objects to the client. How can the client obtain them?

  node.js, question
Middleware:'/', function(req, res, next) {
 res.cookie("demo1_cok", {username: "demo1",password:"aa"}, {maxAge: 600000});
 var oP1=document.getElementById("p1");
 var cok=window.cookie;
 alert(typeof window.cookie);  //are all undefined
 oP1.innerHTML=cok;  //are all undefined

Ask, the content found in Google cookie settings is a bunch of random codes.
How can the client side resolve to get the values of username and password? Thank you

var oP1=document.getElementById("p1");
 var cok=document.cookie.split(';'  )
 alert (typeof document.cookie);  //are all undefined
 oP1.innerHTML=cok[0];  //are all undefined