`
当时我就震惊了
  • 浏览: 32487 次
  • 性别: Icon_minigender_1
  • 来自: 火星
社区版块
存档分类
最新评论

The different between var == and ===

阅读更多

 == non-strict comparison operator

 //可以比较两个参数,即便是不同的类型
 Example:

 var a = "1";
 alert(a == 1); // true
 alert(a == "1"); //true

 === strict comparison operator
 
 //可以比较两个参数,但必须是相同的类型,否则返回false
 Example:

 var a = "1";
 alert(a === 1);// false;
 alert(a === "1");//true;

any more??????????????????????  

 but,Boolean with String is different situation.

 //不知作何解释,测试不行 == 与 === 结果是一样的
 var a = "true";
 alert(a ==/=== true);//false;
 alert(a ==/=== 1); //false;
 alert(a ==/=== "true");//true;
 
 //但是这样就行,JavaScript不能强制转换 Boolean类型
 var a = true;
 alert(a == "1");//true;
 alert(a === "1");//false;




 reference: http://stackoverflow.com/questions/523643/difference-between-and-in-javascript
 
分享到:
评论

相关推荐

    BobBuilder_app

    In the event of page getting full and reaching the PageItemCount, MGIndex will sort the keys in the page's dictionary and split the data in two pages ( similar to a b+tree split) and update the page ...

    WebSocket.Essentials.Building.Apps.with.HTML5.WebSockets

    WebSocket facilitates complete duplex communication between the client and server. HTML5 made it possible to create enterprise-level applications considering the important parameters related to ...

    VclZip pro v3.10.1

    Fixed a lot of incompatabilities between VCLZip and WinZip Other assorted fixes ==================== Version 3.04 Build 1 New ZLib methods for optimized compression and decompression of single ...

    drupal 6.12

    the mod_rewrite module and the ability to use local .htaccess files. For Clean URLs support on IIS, see "Using Clean URLs with IIS" (http://drupal.org/node/3854) in the Drupal handbook. - Various ...

    netWindows_0.3.0_pre2

    between configurable key characters.FEATURES: netWindows represents a new type of DHTML API that helps facilitate the creation and usage of "truly" dynamic interfaces. That is, DHTML ...

    Handbook of Research on Soft Computing and Nature-Inspired Algorithms

    thedistancebetweentherequirementsandtheobtainedtrialsolution.Thedeviceunderdevelopment  canbeanalyzedwithclassicalnumericalmethodologiessuchasFEM,FDTD...

    php.ini-development

    The following are all the settings which are different in either the production ; or development versions of the INIs with respect to PHP's default behavior. ; Please see the actual settings later in...

    WPTools.v6.29.1.Pro

    behaviour between ANSI and UNICODE version - when writing HTML background color is not set to white when shading is 0. 0 is treated as default value. - image align center and right now works in HTML ...

    Bochs - The cross platform IA-32 (x86) emulator

    In addition to the default Bochs method using the CTRL key and the middle mouse button there are now the choices: - CTRL+F10 (like DOSBox) - CTRL+ALT (like QEMU) - F12 (replaces win32 'legacyF12'...

    UG6.0快捷键大全

    MESSAGE Changes the density and the density units for a solid body. SYNONYMS edit mass, thickness, solid property HELP DSN_solid_density BITMAP editsoliddensity ACTIONS STANDARD SEPARATOR ...

    Sql for mysql

    5.9 The Scalar Expression Between Brackets . . . . . . . . . . . . . . . . 106 viii Contents 5.10 The Scalar Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 5.11 Casting of ...

    JavaScript对象验证库js-validator.zip

    boolean验证域的值可以看作是布尔值,可以是true,false,1,0,"1","0",'1' and '0'。date验证域必须为日期字符串形式,可以被Date.parse方法解析。date_format:format验证域必须符合制定的日期格式,允许的日期...

Global site tag (gtag.js) - Google Analytics