@@ -128,10 +128,11 @@ The basic inputs are:
128128The number of attempt fields (in the HTML), the number of ` expected ` values,
129129and the number of ` correct ` values much match.
130130
131- ### JavaScript strings
131+ ### JavaScript notation.
132132
133- The lab data is expressed using JavaScript strings.
134- There's more than one way to express a string in JavaScript, each
133+ The lab data is expressed using JavaScript, primarily as
134+ JavaScript strings.
135+ There's more than one way to express a string in JavaScript, and each
135136has its advantages:
136137
137138* "..." - double-quoted string. You don't need to do anything special to
@@ -148,6 +149,15 @@ has its advantages:
148149 These are often useful for patterns.
149150 Use ${BACKQUOTE} for ` ; and ${DOLLAR} for $.
150151
152+ JavaScript allows trailing commas, and we encourage using them.
153+ In other words,
154+ a list in JavaScript can have the form ` [ 'a', 'b', 'c', ] `
155+ (note the trailing comma after ` 'c' ` ).
156+ Using trailing commas reduces the likelihood of
157+ a common error: forgetting to add a comma when you add an item to a list.
158+ Using trailing commas means that when you add a new item (` 'd' ` ) at the end,
159+ you * already* have the comma ready for use.
160+
151161### Expressing correct answer patterns
152162
153163The patterns used for ` correct ` and ` hints `
@@ -299,6 +309,8 @@ Here's an explanation of this pattern:
299309 This that one of the following patterns is allowed:
300310 ` 'id' ` or ` "id" ` or <tt >` ; id` </tt > (and nothing else).
301311 Again, the space after it means 0+ spaces are allowed.
312+ WARNING: If you use JavaScript raw strings or templates, you
313+ need to escape the backquote (` ; ) character.
302314
3033155 . The ` \) ` matches a literal close parenthesis,
304316 while ` \. ` matches a literal period.
0 commit comments