...

View Full Version : string comparison operation



university
07-30-2011, 06:05 AM
are these right ya?

'3' !=='smith' true
"test" == "test " true
'2' != 'smith' true
"exam" == "Exam" true
5 === "5 " false
"t" > "T" false
"y" >= "p" true
"Happy" == "happy " true

bullant
07-30-2011, 06:56 AM
run the code and see what happens :)

That will tell you if they are right or not.

university
07-30-2011, 06:14 PM
run the code and see what happens :)

That will tell you if they are right or not.

dont have linux!

Philip M
07-30-2011, 07:15 PM
dont have linux!

What has Linux (an operating system) to do with it?

Krupski
07-30-2011, 08:04 PM
dont have linux!

You don't need Linux.

Make yourself a mini webpage and run your statements as Javascript.



<html>
<head>
<script type="text/javascript">

alert('3' !=='smith');

</script>
</head>
<body>
</body>
</html>
Take that code and save it as "test.html" then use your web browser to load it. Go to "file" / "open file", find test.html and open it. A popup will appear and say "true" or "false".

You can edit "test.html" as much as you want and verify anything you like.

(by the way, you have posted several different threads asking for help with what is surely HOMEWORK. We can give you guidance but not do it all for you. TRY FIRST, post what you tried THEN we can help you. Nobody is going to write it all for you).

university
08-03-2011, 05:57 PM
What has Linux (an operating system) to do with it?

lol sorry dont know why i wrote that haha!.

university
08-03-2011, 06:04 PM
You don't need Linux.

Make yourself a mini webpage and run your statements as Javascript.



<html>
<head>
<script type="text/javascript">

alert('3' !=='smith');

</script>
</head>
<body>
</body>
</html>
Take that code and save it as "test.html" then use your web browser to load it. Go to "file" / "open file", find test.html and open it. A popup will appear and say "true" or "false".

You can edit "test.html" as much as you want and verify anything you like.

(by the way, you have posted several different threads asking for help with what is surely HOMEWORK. We can give you guidance but not do it all for you. TRY FIRST, post what you tried THEN we can help you. Nobody is going to write it all for you).

okay so can i use notepad as i dont have editplus..beacause i tried it but nothing comes up because theres nothing written in the body tag?

Old Pedant
08-03-2011, 08:37 PM
But the alert() should still come up.

Works fine for me. Alerts "true" as expected.

If you prefer to see the stuff in the <body>, do this:


<html>
<body>
'3' !== 'smith' ?
<script type="text/javascript">
document.write('3' !=='smith');
</script>
<hr>
"Happy" == "happy" ?
<script type="text/javascript">
document.write("Happy" == "happy");
</script>
</body>
</html>


Clumsy coding, but it will do the job.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum