0

Here is my code so far:

var Qs = require('qs');

function runRequest() {
  return axios({
    method: 'GET',
    url: 'https://proxy.hackeryou.com',
    dataResponse: 'json',
    paramsSerializer: function (params) {
      return Qs.stringify(params, { arrayFormat: 'brackets' })
    },
    params: {
      reqUrl: `https://od-api.oxforddictionaries.com:443/api/v1/entries/en/bomb/synonyms;antonyms`,
      proxyHeaders: {
        'header_params': 'value',
        "Accept": "application/json",
        "app_id": "8ec64674",
        "app_key": "b5a5e3f12d46fc718b916e1aaa1c3509"
      },
      xmlToJSON: false
    }
  }).then((result) => {
       const synonym = result.data.results.map(res=>{
         return res.lexicalEntries.map(secondResult=>{
           return secondResult.entries.map(thirdResult=>{
               return thirdResult.senses.map(fourthRes=>{
                 return fourthRes.synonyms.map(fifthRes=>{
                  turnArray(fifthRes.id)
                  return fifthRes.id;
              })
            })
          })
        })
      });  
  })
    .catch((error) => {
      alert("Oops!");
    });
}

function turnArray(list){
  console.log(list)
}

runRequest();

What I am trying to do is turn this list (see image) into one array enter image description here

Example: ["explosive", "incendiary_device"];

I would like to do this in my turnArray() function. How can I go about doing that?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.