How to add two arrays to an object

  for (let i = 0; i < res.data.words.length - 1; iPP) {
          similar.push(res.data.words[i]);
        }
        this.keys = {
          similar,
        };
   for (let i = 0; i < res.data.words.length - 1; iPP) {
          relative.push(res.data.words[i]);
        }
        this.keys = {
          relative,
        };

what you want to write in this way is this structure. now the question is that there is only one array in the object. How can you overwrite the front?

{
    similar:[""],
    relative: [""]
}
Apr.11,2021

I feel that it is OK to write a sentence like this. Premise this is an object.
uses concat so that similar and relative are two completely new arrays that do not affect each other.

Object.assign(this.keys,{similar:res.data.words.map(m => {return m})},{relative:res.data.words.map(m => {return m})})
Menu