Spelchan.com Logo

From Scratch Web Games: A Beginners Guide to Game Development using HTML, CSS, and JavaScript

Chapter 4.2: History of JavaScript

JavaScript is, whether you like it or not, the language used by browsers. While there have been attempts to add additional options, such as Microsoft trying to get a VBScript in the browser and Google pushing for Dart. These did not take off. Transpilers have had a bit more success with TypeScript being used by an increasing number of developers. Transpilers convert from one language to another, so ultimately you still have JavaScript running on the browser. I have hopes that Web Assembly (WASM) will improve to the point where any language can be used to generate modules for the web but that is the subject for another book.

This success should lead to the question “how did JavaScript come about?” This happened in the early days of web browsers when Netscape was still a dominating force in the browser wars. Sun was pushing their Java programming language wanting a version of it to be included in browsers. For those of you not familiar with Sun, they were predominantly a hardware manufacturer who developed servers and workstations. They were acquired by Oracle which is why Oracle owns Java and the trademark to JavaScript.

Brendan Eich had been hired to create a programming language for Netscape but with the push to include Java into the browser, Netscape decided that if they were going to have a scripting language as part of the browser it should be introduced in the same release as Java. This gave poor Brendan only 10 days to create JavaScript. Granted, the first version of JavaScript was far more limited that what we have today, but it is still an impressive achievement. The initial goal of this language was for it to be a simple glue language tying different parts of the page together. The original name of the language was Mocha, but there were trademark issues with that. They then went with LiveScript but discussions with Sun resulted in them calling the language JavaScript with Sun holding the trademark.

Needless to say, other browser venders created their own clones of JavaScript with different functionality and web developers had a huge headache on their hands. Netscape quickly decided to send JavaScript to a standards body so the European Computer Manufacturers Association (ECMA) was given control over JavaScript but due to the trademark held by Sun, named the standard ECMAScript. The ECMAScript standard was released in 1997. The second and third revisions happened in 1998 and 1999. ES4 was an attempt to add types to the language but was abandoned. Flash’s ActionScript 3 language was based on ES4 and I personally think abandoning it was a huge mistake. There was a long spell before anything happened to the language but in 2009 the language was revisited again with ES5. As JavaScript started to be used more for creating real applications rather than simple scripts the ECMA started releasing versions of the standard annually with the names becoming ECMAScript 20xx with the xx being the year the standard was released.

As is very common today, the standards are continually being updated. I am not too sure I am in favor of this approach and recommend that developers pick a version for a project and stay with that version until the project is done. Unfortunately, the concept of depreciation also exists so trying to stay with an older version can have the problem that features you use have been depreciated and will eventually vanish.

Some astute readers may have noticed that I said Java was in the browser. There was, for a time, an applet tag for including Java programs in the browser. The element was depreciated in HTML 4.01 and is no longer part of HTML. The move away from plugins means that if you are going to have any type of application running in a web page, it should be JavaScript (possibly with WASM modules to speed things up).

Programming is interesting as it borrows aspects from science, engineering, and art. As a result, there are many ways of accomplishing the same thing. This has resulted in many different methodologies on how to write a program. In the early days, we had procedural programming in which programs are written with one main block of code that may call subroutines. Object oriented programming adds the concept of classes and inheritance, which we will cover in a later chapter.

The core concepts behind procedural programming happen to be the core concepts needed for other types of programming so it makes sense to learn programming from a procedural methodology before going into other methodologies. The goal here is to make sure that you have enough programming knowledge to accomplish things. Future chapters will cover more advanced topics.

Chapter contents

Chapter 4 Contents

4.1 Cheat Sheets

A quick summary of the basics of JavaScript.

4.2 History of JavaScript

A brief look at how JavaScript was written in 10 days.

4.3 Comment Controversy

Comments. Why programmers don't write them, and how they should be written

4.4 Variables

Variables are used to store the state of a program.

4.5 (extra) How Computers Represent Data

Bits, Bytes, and data types.

4.6 Math

Math on the computer similar but some symbol differences.

Math functions

Various math operations can be used through the Math class.

4.8 Strings

Strings are what we call blocks of text and are used extensively.

4.9 Calculating true and false

Determining if a conditional expression is true or false

4.10 if (Conditional statements)

Conditional code using the if statement.

4.11 Nested conditions

If statements can contain other if statements, this is called nesting.

4.12 Switch statement

Switch statements are a way of replacing large number of else if statements.

4.13 Functions

Functions let you put common code into a named function that can be called anywhere.

4.14 Looping

Loops allow you to repeat sections of code until conditions are met.

4.15 Nested loops

Just like conditional statements, loops can be nested but this has some special considerations.

4.16 Accessing the Web page

Scripting languages give us the ability to dynamically change the web page.

4.17 Events

Reacting to the user actions is done by handling events.

4.18 Project: Where’s Wendy

Our project for this chapter is a grid search game.

4.19 Project: Where’s Wendy implementation

My solution to the Project.

← previous section
JavaScript Basics Cheat Sheet
next section →
Comment Controversy
Table of Contents