Introducing JavaScript

JavaScript has changed a great deal since it was first introduced but many sites still use outdated techniques. There are even lots of JavaScript tutorials on the web that show you how JavaScript should be written so that it can work in Netscape 2 rather than so that it will work in modern browsers. As a result there are many people who are writing what they think is JavaScript but where what they are producing is more suited to the 20th Century than to the 21st.

Beginners should work through all the basic examples prior to moving on to the other examples which cover separate aspects of JavaScript in more detail.

Most of the JavaScript examples here will work in IE5+, Opera7+ and all versions of Firefox, Safari and Chrome. Those commands introduced in ECMAScript 5 in 2011 are being added to the site where they are supported by the latest version of all popular browsers. Where these new commands are not supported by IE8 or IE7 that information is included in the text since those two browsers might still have to many users for you to ignore. So few people using other browsers fail to keep their browser up to date that lack of support in older versions of other browsers will not have any significant affect.

A few examples of what we can expect from EcmaScript 6 are also included in their own section so you can see the direction that JavaScript is moving in - even though it will probably be quite a while before we can use those commands.

There is a link to jsBin at the bottom right of all the pages. This site provides an easy way to test your JavaScript code online without needing to create an entire web page to run a simple test.

JSON

The JSON object is the second of the static objects provided in JavaScript. It provides just two methods – one for converting an object into a text string and the other to convert a text string definition of an object back into that object. Note that some older browsers do not implement this object and […]

RegExp

JavaScript is one of many languages that support what are known as Regular Expressions. These are a standard way that has been developed for being able to perform search and replace functionality involving strings. The RegExp object is how JavaScript implements regular expressions.

String

As with number, you don’t reference the String object directly but instead use primitive strings in most of your JavaScript. Those strings will automatically be converted to String objects when you decide to call any of the provided methods for manipulating the string. The sole exception to this is String.fromCharCode() which is a static method […]

Math

This is one of the two static objects built into JavaScript. You don’t create your own objects based on the Math object, instead you simply use the properties and methods that it provides directly. A range of mathematical functions are available as methods of the Math object as well as a few numbers such as […]

Number

Most of the time in JavaScript you will work with primitive number variables rather than Number objects. There is also no real reason why you would need to specifically reference Number objects as JavaScript will automatically convert the number primitives into number objects for you when you reference any of the methods that the object […]

This site is © copyright Stephen Chapman - Felgall Pty Ltd 2011-2014.

Privacy Policy | Terms and Conditions

You are welcome to use any the example JavaScript from this site in the scripts for your site or any that you develop for others but may not use the longer example scripts that contain a copyright notice in any other way without permission.