SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 99 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

JavaScript, on the other hand, is traditionally programmed
by using simple functions and variables.
If you??™ve never done OOP before, you might ask yourself why you??™d even bother. You have
variables and you have functions, and if you need to reuse something, you make it a function.
If you need two functions to access the same variable, you can make sure that variable is
declared outside of those two functions. This process is great for small scripts, but it can turn
into quite a mess of code that is hard to read and hard to maintain.
The truth is that when you use JavaScript, you??™re already using objects. It might be the
window object, an HTML element, or an XMLHttpRequest object. In JavaScript, everything is an
object. Learning to use object-oriented concepts can help you to build a more extensible
application and grow beyond simple interactions. It also becomes easier for others to use your
code??”which is important if you want to share your code on the Internet or work in a larger
team of developers.
OOP is a programming paradigm and a way of thinking when coding that can include any
of the following traits:
??? A class is the definition or blueprint for an object.
??? An object is the result when a class is instantiated. It becomes an instance of a class. If
the class is the blueprint, the object is the house.
??? A property is like a variable in that it defines a certain state or stores a value, but is contained
in an object.


Pages:
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111