-
Book Overview & Buying
-
Table Of Contents
Lo-Dash Essentials
By :
Every JavaScript function has a context. If you're coming from an object-oriented language, the function context is a lot like the object a method belongs to. The difference of course is that JavaScript doesn't classify objects in the object-oriented sense of the concept. Instead, functions are bound to a default context, and this can easily be changed at runtime. There are even built-in language mechanisms to make this happen.
Lo-Dash makes changing function contexts easy. We'll need to work with function contexts often when programming with Lo-Dash. We'll take a look at a number of approaches to working with and changing the context of functions now.
Inside a function, the execution context is referred to by the this keyword. This is a special binding that we don't need to declare. It's always available to reference within a given function scope. It's important to keep in mind that it's entirely...
Change the font size
Change margin width
Change background colour