Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1653 How can I compare two strings to ensure they are equal?

You are here: irt.org | FAQ | JavaScript | Text | Q1653 [ previous next ]

If you do really mean text strings then use the comparison (==) operator:

<script language="JavaScript"><!--
var a = 'hello'
var b = 'hello'

if (a == b) alert(a + ' and ' + b + ' are identical');
//--></script>

If you actuall mean String objects then take a look at the article: Text Strings and String Objects

©2018 Martin Webb