From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

A standard function

A standard function - JavaScript Tutorial

From the course: JavaScript Essential Training

Start my 1-month free trial

A standard function

- [Instructor] Looking at prototypical examples of functions like this, is useful but to fully understand functions and how they operate, you really need to see them in a real life scenario. So in the exercise files for this movie, I've set up such an example, and you can see right away that there's a lot more going on here. In this example, I've reduced our previous object demo to its core features. At the top, there is a standard object named 'greenPack' with some basic properties. Then towards the bottom, we have a constant called 'main,' containing the main element of the HTML document, and we use the append method to append some content to that main element. That content is displayed using this function expression called 'addPack.' So now we can look at how the function interacts with the rest of the content. First off, this is a function expression, meaning we have set up a constant. We've given the…

Contents