How to write this with array deconstruction?

config.headers.token = document.cookie.split(";")[2].split("=")[1];
Es6
Aug.28,2021

first of all, I'm embarrassed that I don't understand your question, but I have better suggestions for your code. Of course, the price to pay is that the source code needs to increase the size of 1kb . You can use the package js-cookie . It's easy to get cookie and set cookie:

var sdwo={
        headers:{
            token:0
        }
    }
  ({1:sdwo.headers.token}=[1,2])
Menu