Tuesday , 23 May 2017
Home / Tag Archives: object

Tag Archives: object

Console Object – Advanced JavaScript Tutorial

Console Object

The console object is the recommended way to log errors, messages, and information about what’s going on. All browsers have consoles and are accessible via the console object. Clear your script and add this bit of code. [crayon-5924494f1fa64812592360/] To access the console object, will depend on your browser. If you have FireFox, then you must install firebug in order to …

Read More »

Try-catch Statement – Advanced JavaScript Tutorial

Try-Catch Statement

The try-catch statement is a unique way to handle errors. When errors occur, usually it would be logged into the console for you to see. This can be accessed in a variety of ways in different browsers. Usually you’ll find it in the developer section. The try-catch statement allows you to handle errors in your own way. Let’s clean up …

Read More »

Drawing Images – Advanced JavaScript Tutorial

Drawing Images

If you would like to add your own images into the canvas, then you only have to write a couple lines of code to do so. There are a couple of ways of drawing images onto the canvas, but we’ll be using 1 way which is the image object. Please feel free to download the images I use in this …

Read More »

Text Fields – Advanced JavaScript Tutorial

Text Fields

In this tutorial, we’ll focus on text fields in our forms. There a couple of events, properties and methods to make working with forms easier. Selecting Text Let’s update our document to this. [crayon-5924494f81939152297925/] Alright, let’s clear out our script and add this bit of code. [crayon-5924494f8194a334080871/] In our third line, we use a method called select(). This method will …

Read More »

Event Object – Advanced JavaScript Tutorial

Event Object

The event object is passed into your function whenever an event occurs. This object contains information about the event and even allows you to change how the event phases flow. We’ll be working with our previous example. Update your script to this. [crayon-5924494f8218e004358306/] Our functions have been updated so that we can reference the event object. The event parameter will …

Read More »

Window Object – Advanced JavaScript Tutorial

Window Object

There’s one object to rule them all. That is the global object. Every variable, object and function is part of the global object. The global object can’t be accessed directly. However, most JavaScript host environments create an object that act as the global object. For browsers, this is known as the window object. Let’s take a look at how the …

Read More »

Recursive Functions – Advanced JavaScript Tutorial

Recursive Functions

We’re going to stop talking about object oriented programming for now. Let’s focus on functions. There’s a thing called recursive functions. It’s just a function that calls on itself until a condition has been met. Almost like a loop. Setting Up The Script Clear your script and add this bit of code. [crayon-5924494f83572175652021/] If you don’t know what factorials are, …

Read More »

Inheritance – Advanced JavaScript Tutorial


Another advantage to using prototypes is that you can have inheritance in your scripts. What is inheritance? Well, first let me show you and then I’ll explain. Clear your script and add this bit of code. [crayon-5924494f83a2c022302317/] Alright, let’s break this done. We have 2 objects. One is BankAccount and the other is SavingsAccount. We add a method to the …

Read More »

Object Oriented Programming – Advanced JavaScript Tutorial

Object Oriented Programming

Object oriented programming in JavaScript is different than most programming languages. JavaScript has no acknowledgement of classes. All properties and methods inside an object are just name-value pairs. We’ve discussed object oriented programming before in the JavaScript beginner tutorial series. Now, we’ll go more in-depth of what OOP is. They way we’ve been writing code is what’s called procedural code. …

Read More »

Converting Data Types – Advanced JavaScript Tutorial

Converting Data Types

As you may know, each value has a data type. Since JavaScript supports dynamic datatypes you can change a value’s data type like so. [crayon-5924494f84b84617936575/] In some situations, you’ll want to convert the value to another data type instead of just changing the value. JavaScript offers a variety of functions and methods to do so. Let’s set up things to …

Read More »