编程与软件工程developer.mozilla.org编辑精选
JavaScript 再入门(MDN 经典教程)
A Reintroduction to JavaScript
2014 — 2015,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 MDN 的 JavaScript 再入门指南,面向已有编程经验的人系统回顾语言核心概念,涵盖类型、函数、闭包、对象、原型和数组等。文章用示例解释常见写法与语言特性,也提到一些兼容性注意事项。
为什么经久不衰:它把 JavaScript 的关键概念讲得简明清楚,闭包和原型等难点至今仍有参考价值,适合复习或查漏补缺。
HN 评论精选
推荐 Crockford 视频和《Eloquent JavaScript》作为重新学习 JS 的资源。
我目前正在从头重新学习 JavaScript,并找到了指路明灯:1. Douglas Crockford 的视频;2. 《Eloquent JavaScript》中级教程。
cellover查看英文原文
I am currently in the process of re-learning JavaScript from scratch. And I found the light: 1. Douglas Crockford videos: http://www.yuiblog.com/crockford/ 2. Eloquent JavaScript intermediate level tutorials: http://eloquentjavascript.net/contents.html
赞赏数组 for 循环惯用法,并引用文中对闭包和作用域对象的解释。
文中“更漂亮的数组 for 循环惯用法”很酷:for (var key = 0, value; value = someArray[key++];) { ... }。此外我终于理解了闭包:每当 JavaScript 执行函数时,都会创建一个作用域对象来保存局部变量,并用传入参数初始化;每次函数执行都会创建全新的作用域对象,而且这些对象无法从 JS 代码直接访问……闭包就是函数与它被创建时所处作用域对象的组合。
henryw查看英文原文
The "even nicer [array for loop] idiom" is pretty cool: for (var key = 0, value; value = someArray[key++];) { // value is already defined by for loop console.log('index: ' + key, 'value: ' + value); } Also, I finally understand closures: "Whenever JavaScript executes a function, a 'scope' object is created to hold the local variables created within that function. It is initialised with any variables passed in as function parameters. This is similar to the global object that all global variables and functions live in, but with a couple of important differences: firstly, a brand new scope object is created every time a function starts executing, and secondly, unlike the global object (which in browsers is accessible as window) these scope objects cannot be directly accessed from your JavaScript code... A closure is the combination of a function and the scope object in which it was created."
认为文中原型示例非常清晰,位于自定义对象部分。
这里关于 JavaScript 原型的示例是我见过最好的!它在“Custom Objects”一节。
welder查看英文原文
The example of JavaScript's prototype here is the best I've ever seen! It's in the "Custom Objects" section.
指出该数组遍历惯用法遇到第一个 falsy 值就停止,存在局限。
文章提到一种遍历数组的惯用法,说“更漂亮的惯用法是……”然后给出示例。我想指出,这个“更漂亮”的惯用法行为可能不符合预期——它一旦遇到第一个假值就会停止迭代。我第一次看到时很兴奋,但很快意识到它的局限。
kremlin查看英文原文
The article mentions an idiom for iterating over an array. It says 'an even nicer idiom is...' and then it shows it. I just wanted to say that the behaviour of this 'nicer' idiom may not be what's expected - it stops iterating once it hits the first falsy value. I was quite excited actually when I first saw them idiom, until I quickly realized its limitations
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选