У меня есть лист Google, содержащий список словесных слов, и я пытаюсь написать три функции, которые будут создавать определение, синонимы и антонимы из API Merriam -Webster. Когда я захожу на лист Google и вставлю = runjs (shortdef) или = runjs (синонимы) или = runjs (antonyms), он говорит, что ссылка: Fetch не определен (строка 4). < /P>
Любая справка будет оценена!/**
* Evaluates JS code.
*
* @param {code} code The code to evaluate.
* @return The result from evaluating the code.
* @customfunction
*/
function RUNJS(code) {
return eval(code);
}
< /code>
Определения: < /p>
const API_KEY = 'mykeyhere';
const WORD = 'dance';
fetch(`https://www.dictionaryapi.com/api/v3/re ... =${API_KEY}`)
.then(response => response.json())
.then(data => {
const definition = data[0].shortdef[0];
console.log(definition);
})
.catch(error => console.log(error));
< /code>
Синонимы: < /p>
const API_KEY = 'mykeyhere';
const WORD = 'set';
fetch(`https://www.dictionaryapi.com/api/v3/re ... }&synonyms`)
.then(response => response.json())
.then(data => {
const synonyms = data[0].meta.syns[0].join(', ');
console.log(`Synonyms: ${synonyms}`);
})
.catch(error => console.log(error));
< /code>
antonyms: < /p>
const API_KEY = 'mykeyhere';
const WORD = 'against';
fetch(`https://www.dictionaryapi.com/api/v3/re ... }&antonyms`)
.then(response => response.json())
.then(data => {
const antonyms = data[0].meta.ants[0].join(', ');
console.log(`Antonyms: ${antonyms}`);
})
.catch(error => console.log(error));
Подробнее здесь: https://stackoverflow.com/questions/796 ... tionary-ap