Kyle walks through the code for adding an additional module to the application. This module will generate a random number using the Math.random() function.
(oriental music)…- But let's decide that we want to make ourselves,…just cause I'm not creative enough…to come up with something that we have time for…that's like the secure phrase generation.…So I'm just literally going to…create a random number module,…which does nothing but call math.random,…but we're going to illustrate again this point…of creating some code and using it in both places, okay, so,…what we want to do is, first, come up here to our place…where I've got my hybrid server browser modules.…
And you notice I have one here…that I was kind of already a placeholder anticipation.…So I'm just going to uncomment that,…we're going to call our random number thing Foo for now.…So, uncomment that variable and then come down here,…I've got it commented out.…You can uncomment that line…which is going to expect to find,…as you see on line 67 there, it's going to expect to find…a capital F, Foo.js file in the web JS directory.…
It's a place where I'm putting my hybrid shared modules.…That file doesn't exist but we're going to create it next.…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.