Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. want to help in javascript code

want to help in javascript code

Scheduled Pinned Locked Moved JavaScript
javascriptdatabasedata-structureshelpquestion
2 Posts 2 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_15927994
    wrote on last edited by
    #1

    Before:
    This is not a test. This is line 2.

    After:
    This is totally a test. This is line 2.

    Compare

    Differences:

    // events function buttonCompareClicked() { var textBefore = document.getElementById("textareaBefore").value; var textAfter = document.getElementById("textareaAfter").value; var differences = new TextDifferencer().findDifferencesBetweenStrings ( textBefore, textAfter ); var differencesAsString = differences.toString(); var textareaDifferences = document.getElementById ( "textareaDifferences" ); textareaDifferences.innerHTML = differencesAsString; } // extensions function ArrayExtensions() { // extension class } { Array.prototype.insertElementAt = function(element, index) { this.splice(index, 0, element); } Array.prototype.insertElementsAt = function(elements, index) { for (var i = 0; i < elements.length; i++) { this.splice(index + i, 0, elements[i]); } } Array.prototype.removeAt = function(index) { this.splice(index, 1); } } // classes function TextDifferencer() { // do nothing } { TextDifferencer.prototype.findDifferencesBetweenStrings = function(string0, string1) { var lengthOfShorterString = (string0.length <= string1.length ? string0.length : string1.length); var numberOfExtremes = 2; var passagePairsMatchingAtExtremes = []; for (var e = 0; e < numberOfExtremes; e++) { var lengthOfMatchingSubstring = 0; for (var i = 0; i < lengthOfShorterString; i++) { var offsetForString0 = (e == 0 ? i : string0.length - i - 1); var offsetForString1 = (e == 0 </x-turndown>

    Richard DeemingR 1 Reply Last reply
    0
    • M Member_15927994

      Before:
      This is not a test. This is line 2.

      After:
      This is totally a test. This is line 2.

      Compare

      Differences:

      // events function buttonCompareClicked() { var textBefore = document.getElementById("textareaBefore").value; var textAfter = document.getElementById("textareaAfter").value; var differences = new TextDifferencer().findDifferencesBetweenStrings ( textBefore, textAfter ); var differencesAsString = differences.toString(); var textareaDifferences = document.getElementById ( "textareaDifferences" ); textareaDifferences.innerHTML = differencesAsString; } // extensions function ArrayExtensions() { // extension class } { Array.prototype.insertElementAt = function(element, index) { this.splice(index, 0, element); } Array.prototype.insertElementsAt = function(elements, index) { for (var i = 0; i < elements.length; i++) { this.splice(index + i, 0, elements[i]); } } Array.prototype.removeAt = function(index) { this.splice(index, 1); } } // classes function TextDifferencer() { // do nothing } { TextDifferencer.prototype.findDifferencesBetweenStrings = function(string0, string1) { var lengthOfShorterString = (string0.length <= string1.length ? string0.length : string1.length); var numberOfExtremes = 2; var passagePairsMatchingAtExtremes = []; for (var e = 0; e < numberOfExtremes; e++) { var lengthOfMatchingSubstring = 0; for (var i = 0; i < lengthOfShorterString; i++) { var offsetForString0 = (e == 0 ? i : string0.length - i - 1); var offsetForString1 = (e == 0 </x-turndown>

      Richard DeemingR Online
      Richard DeemingR Online
      Richard Deeming
      wrote on last edited by
      #2

      Member 15927994 wrote:

      can anyone help me

      Not until you learn how to ask a proper question. Dumping 500+ lines of unformatted, unexplained code and appending a vague description of your requirement is not a good question. Start by explaining precisely what you are trying to do, what you have tried, and where you are stuck. When including code, include only the relevant parts of the code, and ensure it is formatted properly by selecting it and pressing the code button on the toolbar, or surrounding it with <pre>...</pre> tags.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups