Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26423 > unrolled thread
| Started by | "Tony Johansson" <johansson.andersson@telia.com> |
|---|---|
| First post | 2014-12-31 17:27 +0100 |
| Last post | 2014-12-31 19:56 +0100 |
| Articles | 11 — 5 participants |
Back to article view | Back to comp.lang.javascript
Found anb example in a bok but foreachIn does not exist "Tony Johansson" <johansson.andersson@telia.com> - 2014-12-31 17:27 +0100
Re: Found anb example in a bok but foreachIn does not exist "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-12-31 19:43 +0100
Re: Found anb example in a bok but foreachIn does not exist Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-01 22:23 -0800
Re: Found anb example in a bok but foreachIn does not exist "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-02 09:28 +0100
Re: Found anb example in a bok but foreachIn does not exist "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-01-02 07:14 -0800
Re: Found anb example in a bok but foreachIn does not exist "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-03 00:19 +0100
Re: Found anb example in a bok but foreachIn does not exist Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-02 08:12 -0800
Re: Found anb example in a bok but foreachIn does not exist "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-02 17:52 +0100
Re: Found anb example in a bok but foreachIn does not exist "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-03 00:04 +0100
Re: Found anb example in a bok but foreachIn does not exist "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-01-02 07:06 -0800
Re: Found anb example in a bok but foreachIn does not exist "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-31 19:56 +0100
| From | "Tony Johansson" <johansson.andersson@telia.com> |
|---|---|
| Date | 2014-12-31 17:27 +0100 |
| Subject | Found anb example in a bok but foreachIn does not exist |
| Message-ID | <m8185d$urk$1@dont-email.me> |
Here is a function that I have found in a book called "Eloquent JavaScript"
but forEachIn does not exist in JavaScript.
How would I changed it so that it works. At the bottom I have give example
how I call this dom function
function dom(name, attributes /*, children...*/)
{
var node = document.createElement(name);
if (attributes)
{
forEachIn(attributes, function (name, value) {
node.setAttribute(name, value);
});
}
for (var i = 2; i < arguments.length; i++)
{
var child = arguments[i];
if (typeof child == "string")
child = document.createTextNode(child);
node.appendChild(child);
}
return node;
}
document.body.appendChild(
dom("p", null, "A paragraph with a ",
dom("A", {href: "http://ericsson.se"}, "link"),
"inside of it."));
//tony
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-12-31 19:43 +0100 |
| Message-ID | <XnsA414C8AE52A3Beejj99@194.109.133.133> |
| In reply to | #26423 |
"Tony Johansson" <johansson.andersson@telia.com> wrote on 31 dec 2014 in comp.lang.javascript: > Here is a function that I have found in a book called "Eloquent > JavaScript" but forEachIn does not exist in JavaScript. > How would I changed it so that it works. Eloquence isn't a sign of quality. If a function in such a book does not "work", the best thing to do is 1 to throw the book away, probably you can still do this this year. 2 define what you want such new function to do. 2 build this function from scratch. You cannot do worse than using a function that does not work, and that you yourself don't understand, and cannot explain, how it should work. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Scott Sauyet <scott.sauyet@gmail.com> |
|---|---|
| Date | 2015-01-01 22:23 -0800 |
| Message-ID | <51b894e7-a370-4e09-9131-ffddab601bbc@googlegroups.com> |
| In reply to | #26424 |
Evertjan. wrote: > Tony Johansson wrote: > >> Here is a function that I have found in a book called "Eloquent >> JavaScript" but forEachIn does not exist in JavaScript. >> How would I changed it so that it works. > > Eloquence isn't a sign of quality. I disagree. Eloquence is not definitive proof of quality, but it is one useful sign. But beyond that, do you have a substantive critique of the book? I've used it to help teach beginning JS programmers. I think it's one of the better ones around. I don't remember seeing any reviews of it here, but I have not been paying very much attention for the last year. Have you read it? At least some versions of it are freely available on the web. > If a function in such a book does not "work", > the best thing to do is > > 1 to throw the book away, > probably you can still do this this year. > > 2 define what you want such new function to do. > > 2 build this function from scratch. 3. Look for earlier definitions in the book for the missing parts. Christoph M. Becker's response has already done that for the OP. Such a response is more informative and IMHO better for the group than a snide disparagement of the book in question.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-01-02 09:28 +0100 |
| Message-ID | <XnsA41660749D35eejj99@194.109.133.133> |
| In reply to | #26429 |
Scott Sauyet <scott.sauyet@gmail.com> wrote on 02 jan 2015 in comp.lang.javascript: > Evertjan. wrote: >> Tony Johansson wrote: >> >>> Here is a function that I have found in a book called "Eloquent >>> JavaScript" but forEachIn does not exist in JavaScript. >>> How would I changed it so that it works. >> >> Eloquence isn't a sign of quality. > > I disagree. Eloquence is not definitive proof of quality, but it > is one useful sign. We are talking about self-declared eloquence, which should make you suspicious. > But beyond that, do you have a substantive critique of the book? > > I've used it to help teach beginning JS programmers. I think it's > one of the better ones around. I don't remember seeing any reviews > of it here, but I have not been paying very much attention for the > last year. > > Have you read it? At least some versions of it are freely available > on the web. The fact that the OP as a beginner should be subjected to code that does not show which used functions are JS-native, and which are to be found elsewhere in the book, does not give me much confidence. >> If a function in such a book does not "work", >> the best thing to do is >> >> 1 to throw the book away, >> probably you can still do this this year. It is clear the book is needlessly complex for the OP. I have never heard of a JS-book that was not: outdated, incomplete, full of errors, error-prone, overselfconfident, etc. JS should better [imho, but that is always implied] be learned than taught. learned by specs, example, trial and error, where the 'teacher' is absent of does not want to express superior knowledge. If found that is true for most other subjects too, believing in a revered teacher usually sets you of on the wrong foot. >> >> 2 define what you want such new function to do. >> >> 2 build this function from scratch. > > 3. Look for earlier definitions in the book for the missing parts. One really should not have to do that, such definitions should be backpointed. > Christoph M. Becker's response has already done that for the OP. Such > a response is more informative and IMHO better for the group than a > snide disparagement of the book in question. Now you are talking, rubish I mean, as 1 why should a responce be "good for the group"? 2 why should a responce be informative? 3 why should a response be be compared with an 'already' one, also given the nonsequential nature of the usenet server system? 4 what is wrong with a 'snide disparagement'? All that is required according to netiquette and charter, is 'on topic', meaning 1 about JS in general or 2 about the NG. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2015-01-02 07:14 -0800 |
| Message-ID | <0dff843b-9289-42df-9447-a85666dcf50b@googlegroups.com> |
| In reply to | #26430 |
On Friday, January 2, 2015 2:28:56 AM UTC-6, Evertjan. wrote: > I have never heard of a JS-book that was not: > outdated, incomplete, full of errors, error-prone, overselfconfident, etc. Then I suggest reading David Herman's book: "Effective JavaScript"
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-03 00:19 +0100 |
| Message-ID | <m87917$itr$1@solani.org> |
| In reply to | #26433 |
Michael Haufe (TNO) wrote: > On Friday, January 2, 2015 2:28:56 AM UTC-6, Evertjan. wrote: > >> I have never heard of a JS-book that was not: >> outdated, incomplete, full of errors, error-prone, overselfconfident, etc. > > Then I suggest reading David Herman's book: "Effective JavaScript" Thanks for the suggestion. As Scott Sauyet has also recommended this book, I've ordered a copy. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Scott Sauyet <scott.sauyet@gmail.com> |
|---|---|
| Date | 2015-01-02 08:12 -0800 |
| Message-ID | <2e3ac47b-5108-4966-8532-94e2abb29253@googlegroups.com> |
| In reply to | #26430 |
Evertjan. wrote: > Scott Sauyet wrote: > >> But beyond that, do you have a substantive critique of the book? >> >> I've used it to help teach beginning JS programmers. I think it's >> one of the better ones around. I don't remember seeing any reviews >> of it here, but I have not been paying very much attention for the >> last year. >> >> Have you read it? At least some versions of it are freely available >> on the web. > > The fact that the OP as a beginner should be subjected to code that does not > show which used functions are JS-native, and which are to be found elsewhere > in the book, does not give me much confidence. This book is a tutorial, not a reference. I think that makes a big difference. A careful reader would have seen that function many times between when it was introduced and when it was used here. But I'm assuming that this is a no. You haven't read the book? > It is clear the book is needlessly complex for the OP. It is only clear to me that the OP ran into an issue and asked for input from this group. The rest is interpretation. > I have never heard of a JS-book that was not: > outdated, incomplete, full of errors, error-prone, overselfconfident, etc. There are better and worse books, though. This one, along with David Herman's _Effective Javascript_ are my most-recommended ones. That's why I was trying to tease out whether you had a serious critique of it. I have of course seen flaws, but on the whole, I find this a worthwhile book for beginning and intermediate Javascript programmers. > JS should better [imho, but that is always implied] be learned than taught. > learned by specs, example, trial and error, where the 'teacher' is absent of > does not want to express superior knowledge. > > If found that is true for most other subjects too, believing in a revered > teacher usually sets you of on the wrong foot. Do you think your preferred learning style should dictate how others choose to learn? >> 3. Look for earlier definitions in the book for the missing parts. > > One really should not have to do that, such definitions should be > backpointed. I agree; at least once in the current chapter it should point to the definitions of any functions its using from previous ones. I don't think Haverbeke does so. But I don't think it's a significant flaw. >> Christoph M. Becker's response has already done that for the OP. Such >> a response is more informative and IMHO better for the group than a >> snide disparagement of the book in question. > > Now you are talking, rubish I mean, as > > 1 why should a responce be "good for the group"? Participating in a community in a way that undermines that community is a good definition of trolling. If that's what you prefer to do, I guess we have little more to say to one another. > 2 why should a responce be informative? It doesn't have to be. It could also be humorous. But if it's neither, then I for one am not interested in it. Maybe others are. > 3 why should a response be be compared with an 'already' one, also given the > nonsequential nature of the usenet server system? The "already" explained why I didn't do so myself. It was not meant to take you to task for not having done so. > 4 what is wrong with a 'snide disparagement'? It's snide. And it's a disparagement. > All that is required according to netiquette and charter, is 'on topic', > meaning 1 about JS in general or 2 about the NG. I responded because I didn't know if behind the snark you had a substantive critique of a book I admire. I would have found that worth hearing. Otherwise I would have dismissed your post as mere noise. I guess I should have done so. -- Scott
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-01-02 17:52 +0100 |
| Message-ID | <XnsA416B5CEEA4A2eejj99@194.109.133.133> |
| In reply to | #26436 |
Scott Sauyet <scott.sauyet@gmail.com> wrote on 02 jan 2015 in comp.lang.javascript: > It is only clear to me that the OP ran into an issue and asked > for input from this group. The rest is interpretation. Eh? So how can something be clear to you without your interpretation? That must be out of dogmatic believe, I suppose? What is wrong with interpretation, anyway? >> 1 why should a response be "good for the group"? > Participating in a community in a way that undermines that community > is a good definition of trolling. Whay nonsense, you are out of line concerning the use of usenet by redefining it as a sort of helpdesk. Responses that are not "enhancing the group" are not per se "undermining" the group, as long as they follow usenet netiquette and group charter. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-03 00:04 +0100 |
| Message-ID | <m87865$fuc$1@solani.org> |
| In reply to | #26436 |
Scott Sauyet wrote:
> Evertjan. wrote:
>> Scott Sauyet wrote:
>>
>>> But beyond that, do you have a substantive critique of the book?
>>>
>>> I've used it to help teach beginning JS programmers. I think it's
>>> one of the better ones around. I don't remember seeing any reviews
>>> of it here, but I have not been paying very much attention for the
>>> last year.
No, there has not been a review of this book ("Eloquent JavaScript" by
Marijn Havebeke) during the last year in this newsgroup -- it has not
even been mentioned before this thread.[1]
>> 4 what is wrong with a 'snide disparagement'?
>
> It's snide. And it's a disparagement.
Very well said. :)
[1] Telling from what my Usenet provider actually provides.
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2015-01-02 07:06 -0800 |
| Message-ID | <7e8398c3-cdf9-4868-8db8-ee119b000ec8@googlegroups.com> |
| In reply to | #26429 |
On Friday, January 2, 2015 12:23:13 AM UTC-6, Scott Sauyet wrote: > I've used it to help teach beginning JS programmers. I think it's > one of the better ones around. I don't remember seeing any reviews > of it here, but I have not been paying very much attention for the > last year. I agree it is one of the better ones available as an introduction to the language. There hasn't been a review here, only a debate on whether the FAQ should include book suggestions (The answer was "No" or "Undecided" IIRC), but that was around the time the debate around FAQ maintenance was occurring. > Have you read it? At least some versions of it are freely available > on the web. <http://eloquentjavascript.net/>
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-12-31 19:56 +0100 |
| Message-ID | <m81gsf$ff7$1@solani.org> |
| In reply to | #26423 |
Tony Johansson wrote: > Here is a function that I have found in a book called "Eloquent > JavaScript" but forEachIn does not exist in JavaScript. > How would I changed it so that it works. Maybe you're looking for: <http://eloquentjavascript.net/1st_edition/chapter8.html#key15>. -- Christoph M. Becker
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web