Over a million developers have joined DZone.

JavaScript String Comparison

·
// Example use
// if (isSameString(tags, "_none_")) ...


      function isSameString( s1, s2 )
      {
        alert( "s1: " + s1.toString() );
        alert( "s2: " + s2.toString() );

      	if ( s1.toString() == s2.toString() )
        {
      	  return true;
        }
        else
        {
          return false;
        }
      }
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}