Errata

Getting Started with p5.js

Errata for Getting Started with p5.js

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 7
Missing media files

Hello,

Media download is missing files:

https://github.com/lmccart/gswp5.js-code

MISSING:
ortiz.csv which is used in Ex_12_01.js
cities.csv which is used in Ex_12_03.js
film.json which is used in Ex_12_04.js
films.json which is used in Ex_12_05.js
cincinnati.json which is used in Ex_12_06.js

See also:
https://github.com/lmccart/gswp5.js-code/issues/4

Margaret Noble  May 03, 2020 
Printed, PDF Page 59
Example 5-1

"print(...)" should read "println(...)" otherwise the example will attempt to print to the currently chosen system printer instead of the console. The same problem appears on page 60, 65, 121, 122, 128, 130, 133, 140, 141, 148. 171, 184, 189, 194, 195, 214, 217, and 218, and the index should also be corrected (page 226).

Eric Iverson  Aug 28, 2016 
Printed, PDF, ePub Page 118
First paragraph

The link pointing to the media.zip file is broken, so anyone attempting to use the files provided to complete the examples will be unable to.

  Nov 16, 2016 
Printed Page 197
1st paragraph

"output.println" used two times on this page should be "output.print" instead

Jan Mølbæk  Feb 09, 2020 
Printed Page 217
all

I expected (and I have confirmed by a few experiments) that p5.js has the same scoping rule as javascript:
"Currently, JavaScript, unlike many other languages, does not support block level scoping. This means that declaring a variable inside of a block structure like a for loop, does not restrict that variable to the loop. Instead, the variable will be accessible from the entire function. It’s worth noting that the upcoming ECMAScript 6 will support block level scopes via the let keyword." from https://www.sitepoint.com/demystifying-javascript-variable-scope-hoisting/

Example #1:
var ii= 59;
function setcolors() {
console.log(ii);
for (var i = 0; i < 10; i++) {
...
}
}
console shows 59

Example #2:
var i= 59;
function setcolors() {
console.log(i);
for (var i = 0; i < 10; i++) {
...
}
}
console shows undefined

Hubert Halkin  Nov 07, 2016