Blogger Information
Blog 35
fans 0
comment 0
visits 25289
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
对象字面量与函数表达式--2019年5月6日22时05分
白守的博客
Original
878 people have browsed it
  1. 写一个while循环, 输出一个数值数组所有的奇数

  2. 实例

    <script>
            // 把结果初始值
        var i = 0
            // 设置一个数组,用于后面获取
        var q = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
            // 循环 i 小于 q.legth(.legth获取数组值) !== 0
        while(i < q.length){
            
            if(q[i] % 2 !== 0){
                document.write(q[i]);
            }
            i ++;
            }
            
            
            </script>

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

  3. 写一个对象字面量, 描述一款你喜欢的手机信息


  4. 实例

            <script>
    
                var huawei = {
                    // name: 键,  '华为p666': 是值
                    name : '华为p666',
                    coc  : '莱卡10摄',
                    cpu  : '麒麟9995',
                    a    : '860核1PB内存'
                }
    
                document.write('<br>' + huawei.name + '<br>' + huawei.cpu + '<br>' + huawei.coc + '<br>' + huawei.a)
            </script>

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

  5.  写一个函数表达式, 计算三个数之和

实例

        <script>
           
        var w = function(){
            var b = 155;
            var n = 521;
            var m = 234;
            var o = 0;
            document.write(o = b+n+m);
        }
        w();        
</script>

运行实例 »

点击 "运行实例" 按钮查看在线实例

    Correction status:Uncorrected

    Teacher's comments:
    Statement of this Website
    The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
    All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
    0 comments