Results 1 to 2 of 2

Thread: Count Lines - Javascript

  1. #1
    Join Date
    Oct 2009
    Posts
    11

    Count Lines - Javascript

    Hi,

    I would like to write a simple JavaScript code that can load up an external JS file and then calculate the number of lines in the code.

    Is there a built-in file i/o function in JavaScript that I can use to open a .JS file and start reading each line and calculate the number of lines?

  2. #2
    Join Date
    Mar 2010
    Location
    England
    Posts
    1,144
    If you load the content of the JS file into a string, then follow this: http://www.knowledgesutra.com/forums...s-in-a-string/

    That should do the trick.

    --
    I have a feeling this would be much easier to do this with server side programming, and it would probably work better too.

Similar Threads

  1. Replies: 0
    Last Post: 29 Jan 2010, 02:25 PM
  2. JavaScript Collector
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 03:28 AM
  3. JavaScript library
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 01:26 AM
  4. element specific javascript
    By gumbo in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 04 Dec 2005, 06:25 PM
  5. element specific javascript
    By gumbo in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 04 Dec 2005, 06:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •