Black & White Series

JavaScript Environment

JavaScript for C or Java Programmers


JavaScript

  • Invented by Brendan Eich at Netscape
  • ECMAScript -> standardization (ECMA, 2011)
  • Originally for small in-browser scripts
  • Local hardware access limitations
    • security
    • platform independence

Experimental environment

Javascript Playground (https://playcode.io/)

interactive environment ideal for starters


Inspection Output

console.log(<string>)
  • A simple form of producing outputs for:
    • inspection
    • learning
  • Not presented on the page
    • unfit for application output
console.log('The dinosaur jumped into the mud')

Sequence of Instructions

  • One instruction per line
    • a semicolon, in the end, is optional
console.log('=== Dinosaur Story ===')
console.log('The dinosaur jumped into the mud')
  • Several instructions in the same line
    • separated by semicolons (mandatory)
console.log('=== Dinosaur Story ==='); console.log('The dinosaur jumped into the mud');

Inserting in a Page

Non-usual form

<!DOCTYPE html>
<html>
  <body>
    JavaScript learning - look at the console.
    <script>
      console.log('=== Dinosaur Story ===')
      console.log('The dinosaur jumped into the mud')
    </script>
  </body>
</html>

References

  • Mozilla MDN - https://developer.mozilla.org

  • Eloquent JavaScript - https://eloquentjavascript.net/

Eloquent JavaScript


André Santanchè

www.ic.unicamp.br/~santanch/

Web2Learn

santanche.github.io/web2learn/