In this section, you will create a JavaScript function that will randomly pick one message in each array and save it as a Captivate variable. Use the following steps to copy/paste the code into the JavaScript window that is currently open in Adobe Captivate:
- Navigate to the Chapter14/js folder of the exercise files.
- Open the 02-pickMessages.js file in any text editor available on your system.
- Use the Ctrl + A (Windows) or the command + A (Mac) shortcut to select all the content of this file.
- Use the Ctrl + C (Windows) or the command +C (Mac) shortcut to copy the content to the clipboard.
- Return to Captivate and paste the code (Ctrl + V on Windows/command + V on the Mac) in the empty JavaScript window after the code already present in the window.
The JavaScript window associated with the On Enter event of slide 1 should now look like what's shown in the following screenshot:
The code you just added to...