JavaScript Programming Language

Necessary Knowledge

Programming basics (loops, flow control, primitive data types, OOP, etc.)

Lecture #1

of JavaScript

Back to 1995

Browser War I

  • Microsoft vs Netscape
  • Internet Explorer vs Navigator
  • Control of the Internet
  • Netscape no longer exists

IE must die!

Brendan Eich

JavaScript creator, Mozilla founder

First version of JavaScript was created in 10 days

May 6-15, 1995

First introduction and deployment in September 1995

Evolution of name

  • First name: “Mocha”
  • September 1995: “LiveScript”
  • December 1995: “JavaScript”
  • June 1997: ECMA-262 Ed. 1, aka ES1

ECMAScript

If you don't like Java, you can use C#, Ruby, Python and so on

but if you don't like JavaScript

Shut Up and Code!

ECMAScript dialects

  • Javascript
    • CoffeeScript
    • TypeScript
    • ...
  • JScript
  • Action Script
  • ...

JavaScript: The assembly of the Web

ECMAScript Philosophy

“don’t break the web”

  • No version (like python 2 and 3).
  • No breaking changes. (not removing features and not changing features)
  • Fully backwards-compatibility.

ECMAScript versions and our course

  • ES3 (1999)
  • ES4 (2008)
  • ES5 or ES3.1(2009)
  • ES6 (2015)

ES 6

  • ECMAScript Harmony
  • ECMAScript.next
  • ECMAScript 6 (or ES6)
  • ECMAScript 2015

Meanwhile...

SpiderMonkey is the code name for the first JavaScript engine

  • V8 uses JIT (just-in-time) compilation to directly emit machine code at runtime.
  • Open source.
  • 1,5+ mln lines of code

JavaScript was designed to be simple...

"JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. This mix of features makes it a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles."

© Wikipedia

JavaScript = Java + Scheme(Lisp) + Self(Smalltalk)

  • Java (syntax, primitive values versus objects)
  • Scheme and AWK (first-class functions)
  • Self (prototypal inheritance)
  • Perl and Python (strings, arrays, and regular expressions)

Douglas Crockford

The World's Most Misunderstood Programming Language
"Lisp in C's Clothing"

http://www.crockford.com/javascript/javascript.html

Wat


                        A == B
                        A == C
                        B != C
                    

                    0 == ''; // true
                    0 =='0'; // true
                    '' == '0'; //false
        

Wat


["10", "10", "10", "10"].map(parseInt);
//Output: [10, NaN, 2, 3]
            

JS: Wat aka "Foot Guns"

https://www.destroyallsoftware.com/talks/wat

2007

Open source wins!

Members of TC39

(Ecma Technical Committee 39)

  • Google
  • Apple
  • eBay
  • Mozilla
  • Intel
  • Microsoft
  • Facebook
  • ...

Open Browsers

  • WebKit/Blink
  • Chromium
  • Firefox

Open Tools

  • Angular/Ember/React
  • Jasmine/Mocha Test Frameworks
  • Grunt/Gulp Task Runner
  • Node.js
  • Atom IDE
  • ....

Nowadays!

JavaScript is everywhere

  1. Desktop & Mobile Browsers
  2. Desktop & Mobile native apps (node-webkit, React Native, Tizen)
  3. Hybrid mobile apps
  4. Server (Node.js…)
  5. NoSQL Databases (MongoDB, CouchDB…)
  6. Operation Systems (FirefoxOS, ChromeOS, Nintendo ES...)
  7. ...

reveal.js - The HTML Presentation Framework

Presentation inside browser

Node.js at PayPal

  • Teams between 1/3 to 1/10 of Java teams
  • Doubled requests per second
  • 35% decrease in average response time
  • Lines of code shrunk by factor 3 to 5
  • Development twice as fast
  • JS both on frontend and backend

JS Fuck

http://www.jsfuck.com/

Web interfaces

Web interfaces

Tessel

Tessel

node-copter

EPAM CEO showcase award 2014

August, 2015

Some project facts:

Emscripten

Unreal Engine

running in a browser

Asm.js

250 KLOC of C
compiled to asm.js (port take 5 days)
running in a browser
at half speed (in 2014)

I

JavaScript

Thank you!

Questions

TODO

Developer survey results