How to make data with api output only if it is there, if not so that 0 is set, for Google Dox, here’s a piece of code
function fData(yourname) { var toonJSON = undefined; var toonJSON = UrlFetchApp.fetch("https://сайт.api" + yourname +""); Utilities.sleep(100); return toonJSON.getContentText(); } function name(yourname) { var cache = CacheService.getDocumentCache(); var toonJSON = fData(yourname); var toon = Utilities.jsonParse(toonJSON); return toon; } function inf(toonName) { var toon = name(toonName); var toonInfo = [toon.weekly[0].level]; return toonInfo; I understand the code should look like
function inf(toonName) { var toon = name(toonName); var info = '0'; for (var i = 0; i < toon.weekly[i]; i++) { info = toon.weekly[i].level; } return info; but apparently something missed = (
"https://сайт.api" + yourname +""- there is clearly an error. You need either a parameter or a slash. It can not beхттпc://сайт.apiимя- nick_n_aifohm check and filter? - nick_n_a