C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Javascript »

Tests whether two expressions are equal using stricter methods


Posted Date: 10 Oct 2008    Resource Type: Code Snippets    Category: Javascript
Author: Bindu BujjiMember Level: Gold    
Rating: 1 out of 5Points: 5






var x = 42;
var y = "42";
if (x === y) {
alert("x is equal to y with a simple test.");
} else {
alert("x is not equal to y");
}


The sample code for equality uses the stricter test, = = =. This code examines the values, but unlike the simpler test, the stricter test also tests variable types. Since variable x is a number and variable y is a string, this equality
test fails.


NOTE:Try with x == y condtion, then you will know the difference.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Tests whether two expressions are equal using stricter methods  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Validate float value while entering using javasript
Previous Resource: Ternary Conditionals in java script
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use