课程: JavaScript Essential Training

今天就学习课程吧!

今天就开通帐号,24,600 门业界名师课程任您挑!

A standard function

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…

内容