Skip to main content

JavaScript (JS): 1. Grammar of JS

JavaScript (JS)
1. Grammar of JS
    • Notifications
    • Privacy
  • Project HomeTools and Techniques in Software Engineering
  • Projects
  • Learn more about Manifold

Notes

Show the following:

  • Annotations
  • Resources
Search within:

Adjust appearance:

  • font
    Font style
  • color scheme
  • Margins
table of contents
  1. Introduction to JavaScript (JS)
  2. 1. Grammar of JS
  3. 2. Organizing
  4. 3. Frameworks
  5. 4. Practice
  6. 5. Bibliography

Grammar

Suggested Reading:

  • “JavaScript: The Good Parts” by Douglas Crockford
  • JS for Cats http://jsforcats.com/
  • Java Script in 10 minutes http://spencertipping.com/js-in-ten-minutes/js-in-ten-minutes.pdf

Documentation

The official documentation is ECMAScript 262 https://www.ecma-international.org/ecma-262/.

JavaScript Quirks

  1. JavaScript has equality (==) and strict equality (===). The latter coerces the operands to the same time and then perform strict equality comparison.
  2. Dot notation can be used to access object members, so can bracket notation.
  3. Scope of where this keyword refers to; could be global object, method object, or even more specific.
  4. Dynamic Typing
> typeof NaN
"number"

> 9999999999999999
10000000000000000

> 0.5+0.1==0.6
true

> 0.1+0.2==0.3
false

> Math.max()
-Infinity

> Math.min()
Infinity

> []+[]
""_

> []+{}
"[object Object]"

> {}+[]
0

>true+true+true===3
true

> true-true
0

> true==1
true

> true===1
false

> (!+[]+[]+![]).length
9

> 9+"1"
91

>91-"1"
90

> []==0
true

Annotate

Next Chapter
2. Organizing
PreviousNext
Web Technology
Powered by Manifold Scholarship. Learn more at
Opens in new tab or windowmanifoldapp.org