`
当时我就震惊了
  • 浏览: 33147 次
  • 性别: 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
 
分享到:
评论

相关推荐

    The-different-between-java-and-cSharp.zip_between

    C#同样如此,但C#引入了“var”关键字,允许隐式类型推断。 - **命名规则**:两者都遵循驼峰命名法,但Java强制方法名首字母小写,而C#允许整个方法名小写。 - **字符串**:Java中的字符串是不可变的,而C#字符串...

    计算机组成教学课件:Chapter2 Machine Instruction.ppt

    This chapter covers a comprehensive range of topics, including instruction sequencing, instruction formats, addressing modes, stacks, subroutines, additional instructions, and the comparison between ...

    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 ...

    Handbook of Research on Soft Computing and Nature-Inspired Algorithms

    thedistancebetweentherequirementsandtheobtainedtrialsolution.Thedeviceunderdevelopment  canbeanalyzedwithclassicalnumericalmethodologiessuchasFEM,FDTD...

    Linux System Administrator Guide Version0.9

    The guide addresses the common debate between referring to the operating system as "Linux" versus "GNU/Linux." This distinction is important because the Linux kernel is just one component of the ...

    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 ...

    JavaScript in 10 Minutes

    Unboxed Values**: Explains the difference between primitive values and their boxed counterparts and the implications for equality checks and other operations. 7. **Silent Failures**: Lists scenarios ...

    Concepts in Electric Circuits

    **Voltage, Current Relationships for R, L, and C**: The behavior of resistors, inductors, and capacitors in AC circuits is different from their behavior in DC circuits. The impedance of these ...

    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 ...

    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...

    Sap Ruby Ajax

    - Send AJAX requests to the server when a user is dropped onto a different list. - Update the UI based on the response received from the server. ### Example Code Snippet Here's a simplified ...

    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 ...

    Effective C#

    **Item 6: Understand the Relationships Among the Many Different Concepts of Equality** - **Concepts:** Value equality, reference equality, and custom equality. - **Explanation:** - **Value Equality:...

    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验证域必须符合制定的日期格式,允许的日期...

    通达信指标公式源码 主力动向副图.doc

    公式中还包含了多个条件判断语句,例如 IF 语句和逻辑运算符,用于实现complex logical relationships between different variables. 例如,在计算主力进出信号时,需要满足多个条件,包括 MMS > REF(MMS,1) 和 ZLGJ...

Global site tag (gtag.js) - Google Analytics