Brendan Eich spent 10 days designing a finished language. It's a hodgepodge of references to multiple languages, such as:
- Basic syntax: borrowing from C and Java languages
- Data structures: borrowing from the Java language, including dividing values into primitives and objects
- Usage of functions: borrowing from Scheme language and Awk language, treat functions as first-class citizens, and introduce closures
- The prototypal inheritance model: borrowing from the Self language (a variant of Smalltalk)
- Regular expressions: borrowing from the Perl language
- String and array processing: borrowing from the Python language
At the same time, it is a dynamic, weakly typed programming language that is well suited for object-oriented and functional programming styles
Dynamic languages, corresponding to static languages, static languages determine the data type of variables at compile time; while dynamic languages determine the data type at runtime
Strong typing and weak typing, a strongly typed language cannot be converted once the type of the variable is determined, and the variable type of the weak type is determined by the application context
Features
Based on prototypal inheritance, that is, each object has a prototype object, and the object uses its prototype as a template to inherit methods and properties from the prototype. A prototype object is also an object, also has a prototype, and inherits methods and properties from its prototype, such types, forming a prototype chain. We will introduce the prototype and inheritance in detail later.
Functions are first-class citizens, and can not only be used like objects, but also have functions passed by value and returned as return values. We also introduce later
Function scope, function scope is lexical scope, which can form closures, we will continue later
what is it composed of
JavaScript = ECMAScript + Document Object Model (DOM) + Browser Object Model (BOM)
ECMAScript: The language itself, consisting of syntax, types, statements, keywords, reserved words, operators, global objects
Document Object Model (DOM): API for manipulating HTML, with many and long names, you can check the documentation - MDN
Browser Object Model (BOM): APIs for manipulating browsers, such as Window, Screen, Location, History, Navigator, Popup, Timing, Cookies
ECMAScript version
time point | Version |
---|---|
1997.7 | ECMAScript 1.0 released |
1998.6 | ECMAScript 2.0 released |
1999.12 | ECMAScript 3.0 released |
2007.10 | ECMAScript 4.0 draft released, disagreements |
2008.7 | Improve some 4.0 functions and release ECMAScript 3.1 |
2009.12 | ECMAScript 5.0 officially released |
2011.6 | ECMAScript version 5.1 released |
2013.12 | ECMAScript 6 draft released |
2015.6 | ECMAScript 6 officially released and renamed "ECMAScript 2015" |
Since then, a version will be released every year, and the year will be released in that year. For example, if it is released in 2022, it will be called "ECMAScript 2022", and in 2023, "ECMAScript 2023" will be released.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。