Beginning AngularJS

(WallPaper) #1
ChApter 1 ■ JAvASCrIpt You Need to KNow

The same thing in XML is considerably more verbose, relatively difficult to manipulate in JavaScript, and more
memory- and storage-intensive. Listing 1-34 shows the JSON from Listing 1-33 represented as XML.


Listing 1-34. The JSON from Listing 1-32 Represented as XML


<?xml version="1.0" encoding="UTF-8" ?>



John
Smith

21 2nd Street
New York
NY
10021


212 555-1234
646 555-4567


It’s important to keep in mind that JSON is an alternative to XML, not a replacement. XML has its advantages
too: it is more self-descriptive and arguably more human-readable than JSON. That being said, when wearing
your JavaScript hat, you will very likely come across JSON much more often, as it is heavily used in many common
scenarios, such as communicating with back-end servers.


Summary


This whirlwind tour of JavaScript won’t make you an expert, but I hope it has been a useful refresher or a quick
introduction. We looked at core language features, such as statements, functions, arrays, and objects. We will be
using these features throughout the rest of the book. Where it is helpful to do so, I will include some handy tips and
notes that elaborate on these topics and others. This should prove particularly useful for readers who are tackling the
JavaScript learning curve somewhat parallel to AngularJS.

Free download pdf