实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
AخA
 
1
<!DOCTYPE html>
2
<html>
3
    <head>
4
        <title>
5
            Increment/Decrement Example 4
6
        </title>
7
        <script type="text/javascript">
8
            var s1 = "2";
9
            var s2 = "z";
10
            var b = false;
11
            var f = 1.1;
12
            var o = {
13
                valueOf: function() {
14
                    return - 1;
15
                }
16
            };
17
            s1++; //value becomes numeric 3
18
            s2++; //value becomes NaN
19
            b++; //value becomes numeric 1
20
            f--; //value becomes 0.10000000000000009
21
            o--; //value becomes numeric
22
            alert(s1);
23
            alert(s2);
24
            alert(b);
25
            alert(f);
26
            alert(o);
27
        </script>
28
    </head>
29
    <body>
30
    </body>
31
</html>