draw = function() {
}
var sayHello = function(xPos, yPos) { text("Halllllllo!", xPos, yPos); }; sayHello(200,200);
var answer = floor(random(0, 8)); if (answer === 0) { fill(0, 255, 0); text("YES", 186, 229); }else if (answer === 1) { fill(0, 255, 0); text("CERTAINLY", 164, 229); }
var book =
{
title: "Harry Potter",
stars: 5,
author: "J.K. Rowling"
};
book.title
book.stars
var Book = function(title, author, numPages) { this.title = title; this.author = author; this.numPages = numPages; };,
var book = new Book("Harry Potter", "J.K.Rowling", 500)
Book.prototype.readItAll = function() { this.currentPage = this.numPages; println("You read " + this.numPages + " pages!"); };
var book = new Book("Harry Potter", "J.K.Rowling", 500);
book.readItAll();
var PaperBack = function(title, author, numPages, cover) { Book.call(this, title, author, numPages); this.cover = cover; }; PaperBack.prototype = Object.create(Book.prototype);
var book = new PaperBack("Harry Potter", "J.K.Rowling", 500, cov)