|
|
|
allen
|
 |
« Reply #1 on: December 05, 2008, 09:05:10 PM » |
|
I'm very, very rusty/novice in the JavaScript department--it has long been an embarrassing matter of fact and something I've wanted to rectify. I've got a brand new, shiny text editor to play with and need something to do to put it through it's paces, may as well give this a look-see. Thanks for the heads up.
|
|
|
|
|
Logged
|
|
|
|
|
housetier
|
 |
« Reply #2 on: December 05, 2008, 09:10:34 PM » |
|
If you want to use javascript to pep up websites, do consider using jquery. It will make your life a lot easier :-) I guess solid knowledge of javascript can also come handy when developing XUL applications or extensions.
|
|
|
|
|
Logged
|
|
|
|
|
|
allen
|
 |
« Reply #3 on: December 05, 2008, 09:14:08 PM » |
|
It's solid understanding I'm after, specifically. My problem is getting started. I drag my feet. Once I find a happy launch pad, I'm insatiable. . .
Slow starter.
And I hate libraries. (Reason I've haven't delved into ruby: rails)
I'm starting to feel like I'm inclined toward counter-productivity...
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #4 on: December 06, 2008, 01:09:46 AM » |
|
I'm finding Douglas Crockford's materials (videos and posts) to be pretty decent -- I learned about these via a post by tinjaw. I also found A re-introduction to JavaScript by Simon Willison to be helpful. My two local currency units 
|
|
|
|
|
Logged
|
|
|
|
|
housetier
|
 |
« Reply #5 on: December 06, 2008, 07:31:02 AM » |
|
The re-introduction was quite informative! Thanks for the hint.
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #6 on: December 08, 2008, 06:24:13 AM » |
|
Thank you for sharing in your original post!
(Tangential note: I just noticed how the Douglas Crockford videos were mentioned in the "Additional Resources" section of "Essential Javascript -- A Javascript Tutorial". From watching some of those videos I was under the impression that "getElementByID" is incorrect while "getElementById" is correct -- I see both on the "Essential..." page. I guess that one is really easy to get wrong.)
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #7 on: December 18, 2008, 06:57:54 AM » |
|
FWIW, I think the following from the "re-introduction" may be mistaken: JavaScript distinguishes between null, which is an object of type 'object' that indicates a deliberate non-value, and undefined, which is an object of type 'undefined' that indicates an uninitialized value — that is, a value hasn't even been assigned yet.
From the ECMA 262 Standard: 4.3.9 Undefined Value
The undefined value is a primitive value used when a variable has not been assigned a value.
4.3.10 Undefined Type
The type Undefined has exactly one value, called undefined.
4.3.11 Null Value
The null value is a primitive value that represents the null, empty, or non-existent reference.
4.3.12 Null Type
The type Null has exactly one value, called null.
Perhaps the text in the re-introduction is a result of the weirdness (broken-ness?) of the typeof operator. According to: https://developer.mozilla...Operators/typeof_Operatortypeof returns "undefined" for values (there's only one as I understand it - undefined) of type Undefined but it returns "object" (!!) for values (again only one - null) of type Null. On a related note, I came across the following at: http://javascript.crockford.com/recommend.htmltypeOf
The typeof prefix operator returns a string based on the type of its parameter. Unfortunately, it provides the wrong result if the operand is null or an array.
The new typeOf global function is intended to replace the defective typeof operator. It produces the same result as typeof, except that it returns 'null' for null and 'array' for arrays.
It can be implemented in JavaScript:
function typeOf(value) { var s = typeof value; if (s === 'object') { if (value) { if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length')) && typeof value.splice === 'function') { s = 'array'; } } else { s = 'null'; } } return s; }
|
|
|
|
« Last Edit: December 18, 2008, 07:03:27 AM by ewemoa »
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #8 on: December 18, 2008, 07:42:56 AM » |
|
I also came across the following today and so far am finding it to be pretty good too: http://www.jgharris.demon...o.uk/jsfeats/JSfeats.htmlAlthough I'm not sure about the following bit: In outline, each object is a collection of properties. Each property has a name and a value. The value can be any member of any of the javascript types.
I've been under the impression that the value portion of a property can not have the value of undefined -- as I understand it, undefined is what is returned if one attempts to access a non-existent property. Edit: this impression seems faulty -- at least testing under Firebug using Mozilla, it looks possible for a property's value to have the value of undefined. Time for hasOwnProperty() and possibly additional code perhaps...Edit 2: I think I know where I picked up my initial impression -- I think it may have been in the first video of Douglas Crockford's series "The JavaScript Programming Language" -- specifically, there is a slide titled "Dynamic Objects" which contains some text: "A name can be any string, a value can be any value except undefined"
|
|
|
|
« Last Edit: January 03, 2009, 04:15:37 AM by ewemoa »
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #9 on: December 19, 2008, 11:07:07 PM » |
|
A Crockford piece of an overview nature: http://javascript.crockford.com/survey.htmlFWIW, I'm finding a combination of the following to be quite helpful in developing my understanding of JavaScript: - reading more than one of these overviews (and on more than one occasion)
- dipping into ECMA 262 for clarification
- use of Firebug to test/verify code samples
Edit: I should add one more item to the list: at least one concrete project to test ideas out on -- in my case FARR plugins via ecaradec's FScript (plus examining czb's myriad plugins) has been quite informative.
|
|
|
|
« Last Edit: December 21, 2008, 02:52:01 AM by ewemoa »
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #10 on: January 02, 2009, 07:44:46 PM » |
|
On a related note, I came across the following at: http://javascript.crockford.com/recommend.htmltypeOf
The typeof prefix operator returns a string based on the type of its parameter. Unfortunately, it provides the wrong result if the operand is null or an array.
The new typeOf global function is intended to replace the defective typeof operator. It produces the same result as typeof, except that it returns 'null' for null and 'array' for arrays.
I came across the following entry at Crockford's blog: Mark Miller of The Google, by closely reading the ECMAScript standard, has discovered a simpler, more reliable test.
Object.prototype.toString.apply(value) === '[object Array]'
|
|
|
|
|
Logged
|
|
|
|
|
|
|
allen
|
 |
« Reply #12 on: January 13, 2009, 10:25:52 PM » |
|
allen, did you end up going through the whole thing and do you have anything more to add regarding it?
What I did read, I enjoyed -- he's obviously quite passionate about the subject and seems to cover things pretty well. I haven't actually gone through the whole thing though--have mostly been reading Pro JavaScript Techniques (physical book) by John Resig. No opinion on that yet.
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #13 on: January 14, 2009, 07:00:30 AM » |
|
Thanks a lot for your comments about "Eloquent JavaScript". I've made it through chapter 2 and my feeling so far is that the author seems to understand JavaScript pretty well and seems technically competent, but I am left wondering whether this is a good reference for my purposes. So far I feel like he is covering things too much (even things perhaps it might be better not to bother with -- e.g. the use of == <- why not always just use === ?). May be I am saying this because I have become brainwashed by Crockford's line of using just particular portions of JavaScript  However, I'm thinking of continuing for a while longer before deciding whether to stop. The Jon Resig book you mentioned was one I was curious about -- but I am actually more curious about his upcoming book "Secrets of the JavaScript Ninja". Incidentally, I am in the middle of watching a talk by him titled " Advancing JavaScript with Libraries" ( MDC link, Ajaxian link). Are you familiar with this one?
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #14 on: January 21, 2012, 01:32:26 AM » |
|
I resumed reading recently and managed to make it through chapters 3 and 4. The extended cats example in chapter 4 is fun  Still haven't found a single resource I would recommend for learning JavaScript. I like this book, but perhaps it could use some supplemental material regarding the idea of avoiding certain parts of the language. On a tangential note, came across Smooth CoffeeScript which appears to have "mixed in" content from Eloquent JavaScript. Anyone given this a read?
|
|
|
|
|
Logged
|
|
|
|
|