DMxMWI-N3wbi3

Untitled

Jan 29th, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. const axios = require("axios");
  2.  
  3. async function getDef(q) {
  4. out = await axios.get("********** API LINK HERE **********" + q).then((response) => { return response.data}).catch((error) => { return error })
  5. return out
  6. }
  7.  
  8. (async () => {
  9. let def = await getDef("fuck");
  10. console.log(def[0].word);
  11. console.log(def[0].phonetic);
  12. console.log(def[0].origin);
  13. let defs = def[0].meanings;
  14. for(var i = 0;i<defs.length;i++){
  15. let mdef = defs[i];
  16. console.log(mdef['partOfSpeech']);
  17. let mdefs = mdef['definitions'];
  18. for(var j = 0;j<mdefs.length;j++){
  19. console.log(mdefs[j]['definition']);
  20. }
  21. }
  22. })();
  23.  
Add Comment
Please, Sign In to add comment