What makes javascript dangerous? What uses that javascript can be used as?
javascript
Solution
Douglas Crockford has a series of lectures that point you at the good parts of JavaScript and what to stay away from:
- JavaScript: the Good Parts
- The JavaScript Programming Language
So some things that make JavaScript a good language include:
- It's strongly influenced by Lisp and has closures and other first class function goodness.
- It has literal object and list notation, making it very easy to specify data structures declaratively.
- It is available in basically every browser without any kind of plug-in.
- Duck typing.
- Prototypical inheritance.
Some of the bad things include:
- Optional semi-colons for statement termination which leads to hard to find bugs.
- Automatic type coercion that leads to hard to find bugs.
- A single global namespace shared by all of the scripts running for a page which can make reuse and maintenance a nightmare.
- Automatically creating/effecting names in the singular global namespace when local variables are improperly declared.
- A screwy way to use prototypical inheritance which can lead to weird bugs when you forget to use `new`.
- Incompatibilities among the leading implementations.
... but there patterns that can help with the namespace issues, there are compilers that will help you avoid some of the bug encouraging stuff and frameworks that will help you avoid the incompatible stuff.
With care, you can stick to the parts of JavaScript that make it a powerful and pleasurable language.
Problem
I have been dabbling around with javascript for fun. I keep wondering why there are some people that do not like javascript because it can be easily abused or badly written. Then there are some people that love javascript because it is a powerful language and very useful for various purposes.