How to save fetched data into variable in javascript
const SWAPI_URL = "https://random-word-api.herokuapp.com/word?number=10";
let darth = [];
fetch(SWAPI_URL)
    .then(response => response.json())
    .then(darthVaderObj => {
        darthVaderObj
        darth.push(darthVaderObj);
    })
console.log(darth)
 
    