What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Script about lock messenger

Script about lock messenger
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Script about lock messenger
quote:
Originally posted by deAd
Cookie, why do you use the === operator as opposed to ==? What difference does it make in this case?
=== and !== are identity operators.
== and != are equality operators.

It is preferred to use identity operators as this gives you a warning with wrong type casting and it is faster because JScript doesn't need to convert the variables first to the same type. It also reduces possible errors you otherwise might not notice so quickly.

The identity operators (=== and !==) compare the content of the variables.
The equality operators (== and !=) compare the content of the variables and the type by first converting the variables to a general type.

Moral:

Always use the identity operators (=== and !==)  when you compare two variables of the same type. eg: when comparing strings or characters.

Thus always use the identity operators (=== and !==) whenever you can and only use equality operators (== and !=) if you really really need to.


for details, see:
CookieRevised's reply to Nudges, Updated.
CookieRevised's reply to How do I declare this?

eg:
if you compare two variables of the same type, like a string with a string, like in the script example in my previous post, it makes much better sense to use the identity operator (===) than the equality operator (==) because you know both variables are strings.

eg:
"5" == 5 is true, eventhough one is a string type and the other is a number.
"5" === 5 is false, since they are not of the same type.

This post was edited on 03-03-2010 at 03:30 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-13-2006 03:18 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Script about lock messenger - by xsuper on 12-13-2006 at 01:04 AM
RE: Script about lock messenger - by Rolando on 12-13-2006 at 01:18 AM
RE: Script about lock messenger - by markee on 12-13-2006 at 01:27 AM
RE: Script about lock messenger - by Spunky on 12-13-2006 at 02:10 AM
RE: Script about lock messenger - by CookieRevised on 12-13-2006 at 02:18 AM
RE: Script about lock messenger - by deAd on 12-13-2006 at 03:11 AM
RE: Script about lock messenger - by CookieRevised on 12-13-2006 at 03:18 AM
RE: Script about lock messenger - by Patchou on 12-13-2006 at 06:00 AM
RE: RE: Script about lock messenger - by markee on 12-13-2006 at 06:14 AM
RE: Script about lock messenger - by Patchou on 12-13-2006 at 06:24 AM
RE: Script about lock messenger - by markee on 12-13-2006 at 06:34 AM
RE: Script about lock messenger - by foaly on 12-13-2006 at 02:13 PM
RE: RE: Script about lock messenger - by markee on 12-13-2006 at 04:50 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On