Cannot read property ‘style’ of undefined — Uncaught Type Error

Add your <script> to the bottom of your <body>, or add an event listener for DOMContentLoaded following this StackOverflow question. If that script executes in the <head> section of the code, document.getElementsByClassName(…) will return an empty array because the DOM is not loaded yet. You’re getting the Type Error because you’re referencing search_span[0], but search_span[0] … Read more

How do I install Angular 2 using NPM?

at https://angular.io/docs/ts/latest/guide/setup.html, is recommended to use QuickStart seed, here is its package.json, so actually we need to download its dependencies: you could also create your custom package.json, by running npm init, copying these dependencies (or most of them) and than running npm install with your package.json

Line continuation characters in JavaScript

If I properly understood your question: For readability, it is fine to align + operator on each row: Anyway, unless you’re using Ecmascript 2015, avoid to split a multiline string with \, because: It’s not standard JavaScript A whitespace after that character could generate a parsing error