Better pig (function arguments)
The story so far
We're going to talk about two things:
- Function arguments
- Accumulating HTML
You can try the new app.
h2.
We're going to talk about two things:
You can try the new app.
h2.
You have a BS template with some JS to load a navbar, and footer. You know how to make input fields, and buttons. You know how to tie JS code to events. You know how to validate. You know how to use variables to coordinate what happens across events. You know how to persist data, and erase persisted data when needed.
This lesson adds a few new things:
Our app will make a fake news feed.
There's a problem with the course data app in the previous lesson. It doesn't remember anything. We created a record set when the page loads:
(function($) {
//Initialize course catalog.
var catalog = [
{
id: 42,
title: "Web apps for happy dogs",
maxEnrollment: 40,
location: "Monty Hall 301"
},
...
];
It was lost when the page ended.
We want something like this:
bc.
Remember that you can download a zip file, to get our standard template.
Here's the JS from the template:
cyco format-code 1