javascript - Javascript 函数 - 在文件中调用两个函数
问题描述
问题:两个函数返回不同的数据,但调用两个函数后都接收到最后一个函数的输出。为什么?
javascript
var printStudentInfo = function () {
return 'Name';
}
var printStudentTerritory = function () {
return 'Age';
}
printStudentInfo();
printStudentTerritory();
解决方案
简而言之,这就是printStudentInfo(); printStudentTerritory();
建议,let someVariable = printStudentInfo(); printStudentTerritory();
因为最后一个函数返回“年龄”。您的变量分配给“年龄”
推荐阅读
- javascript - 从附加的外部内容单击不起作用
- python - 如何从较长的字符串中提取数据?
- android - 滚动时Recyclerview闪烁
- elasticsearch - 无法通过 fluentd/elasticsearch 收集所有 kubernetes 容器/pod 日志
- javascript - 为什么 object[bar] 与 object[foo] 有相同的输出?
- c - 在 VxWorks 下创建串行环回
- javascript - 对象的递归路径
- ios - 如何在swift 3中搜索属性文本中的单词?
- java - 如何让android直接连接mysql
- dart - Angular Dart“reorder-list”组件使用示例