WEEK: 2
Active: January 31st - February 6th
Work Due: February 7th @ 8:00AM

Intro to JavaScript

After reviewing a little about the three standard “languages” used by web browsers, let’s look discuss JavaScript in a bit more detail.

The Mozilla Developer Network describes JavaScript as follows;

JavaScript is a programming language that allows you to implement complex things on web pages. Every time a web page does more than just sit there and display static information for you to look at — displaying timely content updates, or interactive maps, or animated 2D/3D graphics, or scrolling video jukeboxes, and so on — you can bet that JavaScript is probably involved.

Background Info

JavaScript ("JS" for short) is a full-fledged dynamic programming language that, when applied to an HTML document, can provide dynamic interactivity on websites.

JavaScript is incredibly versatile. You can start small, with carousels, image galleries, fluctuating layouts, and responses to button clicks. With more experience, you'll be able to create games, animated 2D and 3D graphics, comprehensive database-driven apps, and much more!

JavaScript is mostly used in the browser, enabling developers to manipulate webpage content through the DOM, manipulate data with AJAX and IndexedDB, draw graphics with canvas, interact with the device running the browser through various APIs, and so on. JavaScript is one of the world's most used languages, owing to the recent growth and performance improvement of APIs available in browsers.

JavaScript itself is fairly compact yet very flexible. Developers have written a large variety of tools on top of the core JavaScript language, unlocking a vast amount of extra functionality with minimum effort. These include:

  • Browser Application Programming Interfaces (APIs) — APIs built into web browsers, providing functionality like dynamically creating HTML and setting CSS styles, collecting and manipulating a video stream from the user's webcam, or generating 3D graphics and audio samples.
  • Third-party APIs to allow developers to incorporate functionality in their sites from other content providers, such as Twitter or Facebook.
  • Third-party frameworks and libraries you can apply to your HTML to allow you to rapidly build up sites and applications.

Recently, JavaScript's popularity has grown immensely, due to its use on the server with the successful Node.js platform - the most popular cross-platform JavaScript runtime environment outside the browser. Node.js allows you to use JavaScript as a scripting language to automate things on a PC and build fully functional HTTP and Web Sockets servers.

Don't confuse JavaScript with the Java programming language. Both "Java" and "JavaScript" are trademarks or registered trademarks of Oracle in the U.S. and other countries. However, the two programming languages have very different syntax, semantics, and uses.

Conceived as a server-side language by Brendan Eich (a then-employee of Netscape Corporation and future co-founder of the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation), JavaScript soon came to Netscape  Navigator 2.0 in September 1995. JavaScript enjoyed immediate success and Internet Explorer 3.0 introduced JavaScript support under the name JScript in August 1996.

In November 1996, Netscape began working with ECMA International to make JavaScript an industry standard. Since then, the standardized JavaScript is called ECMAScript and specified under ECMA-262, whose latest (eight) edition is available in June 2017.

p5.js

For any of you who took the MART120 - Creative Coding 1 course, you may or may not realize it, but you already know a lot about JavaScript!

p5.js is a JavaScript library that utilizes the power of JS, but obfuscates some of its more confusing details. However, everything you learned with regard to functions, variables, operators, objects, iteration, etc. will be very similar, if not identical. Just an FYI.


Next section: