javascript - JavaScript: binding to a variable
问题描述
This may be a naive but i am not able to understand how javascript assign values to its variables. In this book, i came across the following code.
function greaterThan(n) {
return m => m > n;
}
let greaterThan10 = greaterThan(10);
console.log(greaterThan10(12));
How is m assigned the value 12 ? This does'nt give compile time as well as runtime error. Only if i remove m =>, i get an error that m is not defined.
解决方案
推荐阅读
- kotlin - 当 ViewModel 列表项属性更新时,如何设置 RecyclerView 中的属性以更新?
- r - R工作室中的“意外符号”
- javascript - 如何将值从 js 转移到另一个 js
- reactjs - Heroku 托管的 Spring Boot 应用程序并不总是从 Axios 获得 POST 请求
- docker - Ansible docker_network 在缺少 docker 模块时失败
- r - R make install 失败,缺少文件
- python - 如何检查文件然后移动到 hdfs?
- f# - F# 用于多项式的文本表示
- python-3.x - 具有 groupby 条件的新列在数据框中不起作用
- php - Laravel 迁移返回无效的 SQL