library of practical JavaScript examples

Discussion in 'Javascript' started by Manne, Jul 18, 2006.

  1. Manne

    Manne Guest

    I'm looking for a library of practical JavaScript examples. Can you
    recommend any?
    Thanks for your time.
    Manne, Jul 18, 2006
    1. Advertisements

  2. Manne

    Matt Kruse Guest

    Could you be more vague?
    Matt Kruse, Jul 18, 2006
    1. Advertisements

  3. Depends. Are you experienced or just starting out with the language.
    If the latter, try looking though the examples at the bottom of this

    Otherwise, you'll need to be more specific as to what kind of examples
    you're looking for... some sites specialize.

    Kevin Darling, Jul 19, 2006
  4. JRS: In article <>
    , dated Tue, 18 Jul 2006 09:24:20 remote, seen in

    Be warned : many such are old and contain amateurish coding.

    Be particularly wary of those which allow almost anyone to contribute
    almost anything without applying quality control.

    For example, one such site contains code obviously copied (without
    permission) from my site; but it has been so carelessly copied as to be
    of little use as it stands.

    When using libraries, remember that the whole of a page, and of the
    include files that it uses, must in general be transmitted to the
    reader, who may be on a radio or dial-up link. Therefore, use the sort
    of library that allows you substantially to select, as an author, only
    code which will be executed, and avoid the sort which provides only vast
    multi-purpose chunks.

    Watch out also for those who code for one specific version of one
    Dr John Stockton, Jul 19, 2006
  5. Manne

    Matt Kruse Guest

    Two points:

    1) In many cases, you can't determine which code will be executed. You can
    often only determine which code can _possibly_ be executed.

    2) If 5 different pages each use 50% of a 10k "multi-purpose chunk" of code,
    it is better to deliver the 10k chunk once and let the browser cache it (10k
    total download) vs. delivering 5k of page-specific code 5 times (25k total

    I favor writing smaller "multi-purpose chunks" of compacted code, and having
    the page select which ones it needs to include. Then you can properly
    benefit from caching, include only the small libs which you actually need on
    the page, and have a single lib which doesn't have to be cut up and
    delivered in smaller chunks.

    Further, the creation of "multi-purpose chunks" facilitates code sharing and
    reuse (see my sites below) while code written by dissenting authors is often
    not shared for others to benefit from.
    Matt Kruse, Jul 20, 2006
  6. Manne

    Manne Guest

    Sorry that was a bit vague. I do have some knowledge of programming and
    web development. I've read the core guide and feel I could have a go
    messing around with other peoples examples.
    I was looking for something like this where people
    can upload examples of there JS work. The site makes it easy to search
    for stuff you might be interested in.
    Manne, Jul 20, 2006
  7. JRS: In article <>, dated Wed, 19 Jul 2006
    22:40:01 remote, seen in Matt Kruse
    True, which is why I included "substantially". And "be executed" must
    of course include all accesses.

    It is bad, for example, to import a complete
    function DateObjectFromString(Str, WhichOfVeryManyFormats)
    into a page which will only use a single hard-coded value for the second

    <URL:> contains such a
    function, but much of the functionality is provided in chunks marked
    //optional paragraph
    If all five pages will be fetched. But the longer it takes for the
    first page to be fetched, the more likely the reader is to give up and
    go elsewhere.
    Dr John Stockton, Jul 20, 2006
  8. Manne

    Matt Kruse Guest

    If the function is only a few k, then it is certainly not bad. Far better
    than including a typical image in a web page.
    Don't be dramatic. Many pages have 50k or more of images on them. People
    don't leave.
    Including 10k, 20k, 30k, or more of cache-able javascript is certainly no
    worse, and I've never known anyone to actually abandon a site because of
    reasonable-size javascript code being delivered to the browser.
    Matt Kruse, Jul 21, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.