newprop 1 4 realnewprop 1 5 fakenewprop 1 BAD silently fails since fake isnt

Newprop 1 4 realnewprop 1 5 fakenewprop 1 bad

This preview shows page 247 - 249 out of 517 pages.

real.newprop = 1; 4 real.newprop // => 1 5 fake.newprop = 1; // BAD: silently fails since ’fake’ isn’t true object 6 fake.newprop // => undefined 6.10 Concluding Remarks: JavaScript Past, Present and Future JavaScript’s privileged position as the client-side language of the Web has focused a lot of energy on it. Since most smart phones and tablets can now run JavaScript, source-portable mobile device apps can be created using HTML, CSS and JavaScript, rather than creating separate versions for different mobile platforms such as iOS and Android. Frameworks like PhoneGap make JavaScript a productive path to creating mobile apps, especially when combined with flexible UI frameworks such as jQuery Mobile or Sencha Touch. Indeed, today the main reason not to use JavaScript for mobile apps is insufficient performance, but because of increased reliance on JavaScript for both “Web 2.0” sites and complex SPAs such as Google Docs, developers have been focusing on both performance and productivity in JavaScript. Performance. Just-in-time compilation (JIT) techniques and other advanced language engineering
Image of page 247
features are being brought to bear on the language, closing the performance gap with other interpreted and even some compiled languages. Over half a dozen JavaScript engine implementations and one compiler (Google’s Closure) are available as of this writing, most of them open source, and vendors such as Microsoft, Apple, Google, and others compete on the performance of their browsers’ JavaScript interpreters. Evaluating the performance of interpreted languages is tricky, since results depend on the implementation of the interpreter as well as the specific application, but benchmarks of the Box2D physics engine found the JavaScript version to be 5x slower than the Java version and 10–12x slower than the C version, and found performance differences of up to a factor of three using different JavaScript interpreters. Still, JavaScript is now fast enough that in May 2011, Hewlett-Packard used it to rewrite large parts of its Palm webOS operating system. We can expect this trend to continue, because JavaScript is one of the first languages to receive attention when new hardware becomes available that could be useful for user-facing apps: for example, WebCL proposes JavaScript bindings for the OpenCL language used for programming Graphics Processing Units (GPUs). Productivity. We saw over and over again in studying Ruby and Rails that productivity goes hand in hand with conciseness. JavaScript’s syntax is hardly concise and often awkward—in part because JavaScript was always functional at heart (recall that its creator originally wanted to use Scheme as the browser scripting language) but burdened by a marketing-driven requirement to resemble the imperative language Java. CoffeeScript , first released in 2010, tries to restore some syntactic conciseness and beauty befitting JavaScript’s better nature. A source-to-source translator compiles CoffeeScript ( .coffee ) files into .js files containing regular JavaScript, which are served to the browser. The Rails
Image of page 248
Image of page 249

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors