javascript - 如何在 Javascript 中将数据变量带出 .then() 方法
问题描述
一切正常,但是如何将变量“数据”从 .then() 方法中取出,以便稍后在程序中调用它?
fetch("http://localhost:8088/get/value")
.then(response => response.json())
.then(data => console.log(data));
解决方案
推荐阅读
- python - 是否有任何脚本或代码可以使用程序打开 Android 应用程序?
- python - 如何在python数据表中填充空值?
- assembly - MASM 不会插入带有某些 CPU 和 FPU 指令组合的 x87 WAIT 前缀
- google-chrome - 谷歌浏览器显示问题
- mongodb - 如何从另一个 mongodb 集合中获取字段并将这些字段值作为数组添加到当前集合中?
- javascript - React-router URL,路由节点/快递和文件结构
- gdb - 如何设置 gdb-multiarch 以支持 PowerPC 架构?
- android - Android Klaxon 库:我无法处理复杂的 json 响应
- objective-c - MFMailComposeViewController canSendMail 返回 NO
- javascript - Pug 未呈现 Javascript