# Update a lesson's test to support trailing commas

**URL:** <https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194>\
**Category:** freeCodeCamp Contributors\
**Tags:** contributing\
**Created:** [October 21, 2022, 4:21pm UTC](https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194 "2022-10-21T16:21:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fuwwy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/fuwwy/32/289512_2.png) [@Fuwwy](https://forum.freecodecamp.org/u/Fuwwy)\
**Post date:** [October 21, 2022, 4:21pm UTC](https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194/1 "2022-10-21T16:21:40Z")

</div>

The assignment “[Use Destructuring Assignment to Assign Variables from Nested Objects](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects)” uses a regex that does not support leading-comma destructuring (such as { property: alias, /\* ← this \*/ }).

The _lowToday_ and _highToday_ test case regexes should be updated to include this syntax: `/(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)}\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g` (changed `highToday\s*` to `highToday,?\s*`)

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [October 21, 2022, 4:27pm UTC](https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194/2 "2022-10-21T16:27:26Z")

</div>

It half supports adding extra unneeded commas. Should be an easy fix.

> <https://github.com/freeCodeCamp/freeCodeCamp/pull/48176>
>
> Checklist:
> 
> 
> 
> \- \[x\] I have read \[freeCodeCamp's contribution guidelines\](htt…ps://contribute.freecodecamp.org).
> \- \[x\] My pull request has a descriptive title (not a vague title like \`Update index.md\`)
> \- \[x\] My pull request targets the \`main\` branch of freeCodeCamp.
> \- \[x\] I have tested these changes either locally on my machine, or GitPod.
> 
> 
> 
> Closes #XXXXX
> 
> Reported on the forum: https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [April 22, 2023, 4:27am UTC](https://forum.freecodecamp.org/t/update-a-lessons-test-to-support-trailing-commas/565194/3 "2023-04-22T04:27:53Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
