javascript - 当我使用模板文字并运行代码时,结果未定义
问题描述
如果我写:
let x = 10;
let y = 20;
console.log(`Okay this is the answer: ${x+y}`);
我得到的结果是:
Okay this is the answer: 30
=> undefined
let x = 10;
let y = 20;
console.log(`Okay this is the answer: ${x+y}`);
我不明白这=> undefined
在控制台中显示的结果中意味着什么。
注意:虽然上面给出的代码片段没有显示=> undefined
,但如果我们在浏览器的控制台或repl.it中运行代码,它就会显示出来。
解决方案
推荐阅读
- sql - 将 SQL Server 代码转换为 MS Access SQL 代码 - DISTINCT 问题
- c# - 在 C# 中是否可以用值实例化一个类?
- python - 未调用类方法 - Python Tkinter
- python - 通过有序字典搜索
- bootstrap-modal - 使用 TypeScript 自定义确认框
- java - 如何正确更新 Fragment 中的 GraphView 对象(GraphView 未使用传入数据进行更新)
- python - 如何使用 Python 安全地编码内容配置 HTTP 标头?
- greenplum - 如何在Greenplum中实现负载均衡
- php - 使用 curl 登录返回相同的登录页面
- java - 如何使用spring get bean将父引用分配给子对象