APPENDIX
Exercise Answers
CHAPTER 1
1. A native app runs executable code on the device and is installable through the App Store. A web app runs inside of Safari on IOS and requires no installation onto the device. A native app is written in Objective-C whereas a web app is written using HTML, CSS, JavaScript, and AJAX.
2. Yes. A user can add a web app to the Home screen through the Safari menu.
3. A finger can emulate normal mouse actions — a click, scroll, and mouse move. However, it also has additional touch-related actions that have no mouse equivalent, including a tap, flick, drag, and pinch.
CHAPTER 2
1. Use var to declare a keyword, such as var index = 0;.
2. A local variable is accessible only inside a JavaScript function, whereas a global variable is accessible anywhere in the document.
3. The = assigns a value whereas the == operator is used to compare whether two values are equal.
4. !=
5. The basic structure of a for loop looks something like:
for (var i=0;i<10;i++) { // Do something here }
6. Use arguments.length to determine to the total number of parameters passed to a function.
7. No. JavaScript treats an empty string as a different value than null.
CHAPTER 3
1. The node is the basic component of the DOM.
2. False. A DOM hierarchy is not exactly the same as the element hierarchy that is shown in an HTML document. For example, attributes and text content of an element are child nodes of that element rather than being a descriptor of it.
3. A NodeList is a ...