![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||||||||||
| |||||||||||||
|
|
Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) Review review: |
|
"Logically, a null value is an empty object pointer" Plainly false. Null is a primitive value. In java (not javascript) |
|
"Certain statements cause a temporary addition to the front of the "scope chain that is later removed after code execution." |
|
Chapter 5 is about reference types — Object, Array, Date, RegExp, etc. |
|
Another misleading assertion was — "Though ECMA-262 doesn’t indicate a way to access the Global object directly […]". |
|
It’s not clear why Mr. Zakas didn’t provide and explain rather ubiquitous way of accessing Global object from within any context — (function(){ return this; })(); ). |
|
Unfortunately, it starts somewhat badly by making few erroneous statements about function expressions |
|
when simulating private variables it uses undeclared assignment to define variable as global one and does so on purpose! This is especially bizarre, |
|
Quite shockingly, an example of document.createElement specifics in IE is presented with blatant and completely unnecessary browser sniff. |
|
I wish there was more emphasis on the dangers and fragile nature of browser sniffing in this part of the book. |
| It would be nice to see alternative example which would avoid run-time try-catch in favor of single load-time test |
|
There were moments when I didn’t share same vision as Mr. Zakas, such as the one where he recommends to use comments in places where there are large amounts of code; I believe in a different approach — breaking code into smaller, more understandable chunks, rather than adding comments on top. |
|
The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. Your review is already quite long. Looks like "Professional JavaScript" |
#3
| |||
| |||
|
|
Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. typo: |
#4
| |||
| |||
|
|
Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. |
|
I almost fully agree with everyone that’s being said here. |
#5
| ||||||||||||
| ||||||||||||
|
|
kangax wrote: Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) Review review: From the review: | "Logically, a null value is an empty object pointer" Plainly false. Null is a primitive value. In java (not javascript) Reference Variables can have the value null, and what is written above is conceptually fine for programming in java, but the type of thinking might be better off abandoned for javascript programming. |
|
Javascript variables are untyped. Null is a primitive value in javascript. It is best to think of it this way (reality) rather than allude to concepts for other languages. |
|
| "Certain statements cause a temporary addition to the front of the | "scope chain that is later removed after code execution." There is a long standing bug in JScript (still in the latest in IE8) where the parameter in a |catch| block does not result in augmented scope for that block. Instead, the identifier is added to the containing scope. Is this not mentioned? |
|
| Chapter 5 is about reference types — Object, Array, Date, RegExp, etc. The terminology "reference types" is incorrect. Those are built-ins. The Reference type is a specification mechanism. |
|
| Another misleading assertion was — "Though ECMA-262 doesn’t indicate a | way to access the Global object directly […]". Plainly false. In global context: var global = this; |
|
(and can be used as in the following: | It’s not clear why Mr. Zakas didn’t provide and explain rather | ubiquitous way of accessing Global object from within any context — | (function(){ return this; })(); ). | Unfortunately, it starts somewhat badly by making few erroneous | statements about function expressions Yep. The FAQ should really have a section on Functions. |

|
| when simulating private variables it uses undeclared assignment to | define variable as global one and does so on purpose! This is | especially bizarre, and | Quite shockingly, an example of document.createElement specifics in IE | is presented with blatant and completely unnecessary browser sniff. Not following his own advice, is he? |
|
| I wish there was more emphasis on the dangers and fragile nature of | browser sniffing in this part of the book. You already know where Nicholas stands on browser detection, so that should come as no surprise. URL: http://www.nczonline.net/blog/2009/09/15/iframes-onload-and-documentdomain/#comment-3121 |
| | It would be nice to see alternative example which would avoid run-time | try-catch in favor of single load-time test I see. The performance video "speed up your javascript" also has an example doing the same thing (against advice in that same video). |
|
| There were moments when I didn’t share same vision as Mr. Zakas, such | as the one where he recommends to use comments in places where there | are large amounts of code; I believe in a different approach — | breaking code into smaller, more understandable chunks, rather than | adding comments on top. Your review should recommend your influence on advice for writing such "clean code". |
|
The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. Your review is already quite long. Looks like "Professional JavaScript" needs more work. Sometimes, less is more. |
|
"7/10" is either something worth recommending or a C-. I'm not sure. |

#6
| |||
| |||
|
|
kangax wrote: Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. typo: localStorage.setItemt('clear', 'foo'); Should be: localStorage.setItem('clear', 'foo'); |
#7
| |||
| |||
|
|
kangax wrote: Here's a review of "Professional Javascript" by Zakas (http://thinkweb2.com/projects/prototype/professional-javascript-review/) The book is pretty big and I didn't have much time, so the coverage is not as extensive as it could have been. However, it should serve as a pretty good overview, highlighting pros and cons, and warning about some of the errors/misconceptions I encountered. Wrong wording: | I almost fully agree with everyone that’s being said here. s/everyone/everything |
#8
| |||
| |||
|
|
Javascript variables are untyped. |
|
Null is a primitive value in javascript. |
|
| Another misleading assertion was — "Though ECMA-262 doesn’t indicate a | way to access the Global object directly […]". Plainly false. In global context: var global = this; |
#9
| |||||
| |||||
|
|
Garrett Smith wrote: Javascript variables are untyped. That's a wrong statement, you must be thinking of VBScript where indeed all variables independently on the current value are of the same Variant type. JavaScript is a *loosely typed* language, that means that each variable is of some certain type but this type can be changed to another one at runtime. |
|
Null is a primitive value in javascript. Another wrong statement: null in JavaScript is an object with the only property null: window.alert(typeof null) // 'object' |
|
This way by assigning null to an object reference, we are dereferencing the said object. |
|
If it is the last existing reference then the relevant scavenger will be marked as garbage collection available on the next GC check. Not sure what is so alien here in comparison with other languages. |
|
| Another misleading assertion was — "Though ECMA-262 doesn’t indicate a | way to access the Global object directly […]". Plainly false. In global context: var global = this; Plainly false: in global context [this] refers to the window host object, not to Global. |

#10
| ||||||
| ||||||
|
|
Garrett Smith wrote: Javascript variables are untyped. That's a wrong statement, you must be thinking of VBScript where indeed all variables independently on the current value are of the same Variant type. JavaScript is a *loosely typed* language, that means that each variable is of some certain type but this type can be changed to another one at runtime. |
|
Null is a primitive value in javascript. Another wrong statement: null in JavaScript is an object with the only property null: |
|
*window.alert(typeof null) // 'object' |
|
This way by assigning null to an object reference, we are dereferencing the said object. If it is the last existing reference then the relevant scavenger will be marked as garbage collection available on the next GC check. Not sure what is so alien here in comparison with other languages. |
|
| Another misleading assertion was — "Though ECMA-262 doesn’t indicate a | way to access the Global object directly […]". Plainly false. In global context: var global = this; Plainly false: in global context [this] refers to the window host object, not to Global. |
|
Let's do not mix "syntax sugar" added atop in some engine implementations with the actual mechanics, it might be dangerous. |
![]() |
| Thread Tools | |
| Display Modes | |
| |