# Lesson 7 - Activity 1: Do you need help working with functions?

**URL:** <https://club.ministryoftesting.com/t/lesson-7-activity-1-do-you-need-help-working-with-functions/30700>\
**Category:** Discussions\
**Tags:** javascript, javascript-intro\
**Created:** [2 November 2019 01:36 UTC](https://club.ministryoftesting.com/t/lesson-7-activity-1-do-you-need-help-working-with-functions/30700 "2019-11-02T01:36:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwinteringham](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/mwinteringham/32/9023_2.png) [@mwinteringham](https://club.ministryoftesting.com/u/mwinteringham)\
**Post date:** [2 November 2019 01:36 UTC](https://club.ministryoftesting.com/t/lesson-7-activity-1-do-you-need-help-working-with-functions/30700/1 "2019-11-02T01:36:21Z")

</div>

**Time:** 1 - 5 hours

**Purpose:** This activity helps you get familiar with functions in JavaScript by tasking you with using them in the random data generator.

**Introduction:** Our code currently has a lot of repetition in it which needs to be cleaned up and encapsulated properly.

For this activity, you can either use your existing random data generator code you’ve created or you can [use this example code-base](https://github.com/mwinteringham/intro-to-js-material/blob/master/lesson_7/activity_1.js).

**Task:** Update your current random data generator code-base to:

1. Use a function to remove any duplicate code
2. Replace the ‘prices’ arrray with a function that will create a random integer

If you need help, post questions on this thread for support.
