我需要帮助:)
我正在尝试获取这样的数组:
['XSRF-TOKEN=advlqegqeozvqqeax; Max-Age=259200; Expires=Mon, 09-jul-2011 22:28:41 GMT; Path=/',
'JWT-SESSION=qefqefoizxivhiohqdiovhoiqeioghqehoghioqe; Max-Age=259200; Expires=Wed, 13-jul-2011 22:28:41 GMT; Path=/; HttpOnly' ]
这样说:
XSRF-TOKEN=advlqegqeozvqqeax; JWT-SESSION=qefqefoizxivhiohqdiovhoiqeioghqehoghioqe;
但我是 NodeJS 的新手,我正在努力学习,
你们能帮我吗?我被困了很长时间:(
非常感谢
你可以写这样的东西:
const array = [
'XSRF-TOKEN=advlqegqeozvqqeax; Max-Age=259200; Expires=Mon, 09-jul-2011 22:28:41 GMT; Path=/',
'JWT-SESSION=qefqefoizxivhiohqdiovhoiqeioghqehoghioqe; Max-Age=259200; Expires=Wed, 13-jul-2011 22:28:41 GMT; Path=/; HttpOnly'
]
const result = array.map( properties => properties.split(';')[0] ).join(';')
console.log(result);
这是我使用的功能:
- 地图
- 分裂
- 加入