Week 4

JavaScript Objects

JavaScript objects are data structures that can be used to aggregate, encapsulate, and abstract information. Objects also serve as a way to template structures for duplication and reuse. An object can be defined using the Object Initialiser, which uses curly brace notation with members defined inside.

MDN reference

    myObject = {
        memberVariable: "I'm a member variable",
        memberFunction: function() {
            console.log("I'm a member function");   
        },
    }

    myObject.memberFunction();
                

HTML Forms

HTML Forms are used to collect data from the user. Forms support a variety of input types.

Create a new account


Input type Input element
button
checkbox
color
date
email
file
hidden
image
number
password
radio
range
reset
submit
text
url


Animation Replay

Animations can be replayed by replacing the animation container with a fresh copy.


JS Animation

JS Animation is achieved by using a perpetual loop and updating properties of HTML elements via the DOM API.