JavaScript

programming
Author

Hongyang Zhou

Published

January 5, 2022

Modified

January 6, 2022

圣诞假期到现在陆陆续续在学习一些JavaScript,期望触类旁通,理解语言的共性和不同。JavaScript作为常年霸榜的编程语言,它的兴起和流行和互联网的发展密不可分。在HTML5的时代,Javascript的地位也依旧没有任何被撼动的趋势,只是出现了更多后继衍生品,比如TypeScript。然而,现代JavaScript的这套骨架被历任程序员在实践中反复验证,证实了它的完备性和实用性。经过二十余年的发展,如今的版本几乎涵盖了我所知的所有编程概念和规则。

计算机相关的知识,我对于互联网方面了解得最少,这也是涉猎JavaScript的动机。

教程

最新、最全、可能是我见过最好的编程语言介绍:JAVASCRIPT.INFO。在当下学习一门编程语言,借由所有人的知识共享,应该感到无比幸福。

笔记

  • JavaScript is dynamically compiled,目前比较出名的编译器比如Chrome里面的Node.js。

  • JavaScript is faster than Python (compiler > interpreter).

  • JavaScript is both functional and object-oriented.

  • 'use strict' is a similar workaround as implicit none in Fortran for backward compatibility.

  • Callback is a pretty common concept, but very useful. A default empty callback function can be defined via cb = () => void 0.

  • Promise is an alternative to callback, which in certain cases gives us more flexibility. I feel like this concept of promise is quite similar to stream/task graph in CUDA.

  • Generator is an advanced concept on top of iterables.

  • The module system in JavaScript become language-level standard in 2015.