无标题文章

function test(){
var x = 10;
var y = 20;
return function () {
alert(x);
alert(y);
};
}
var x = 30;
var y = 40;
var temp = test();
temp(); //10 20

    function A(){
    }
    A.prototype.x = 10;
    var al = new A();
    A.prototype = {x:20,y:30};
    var a2 = new A();
    alert(al.x);
    alert(al.y);
    alert(a2.x);
    alert(a2.y); //10 undefined 20 30 
    

    alert("5" + 3);  //53
    
    9题航空
    var prices = {
        a : {
            price : 100
        },
        b : {
            price : 500
        },
        c : {
            price : 200
        },
        d : {
            price : 400
        },
        e : {
            price : 300
        },
    }
    var arr = Object.keys(prices).sort(function (a,b) {
        return prices[a].price - prices[b].price
    });
    console.log(arr);
    for (var a in arr) {
        console.log(arr[a] + prices[arr[a]].price);
    }
    
    10题
    function f (a) {
        if (a == 0 || a == 1) {
            return 1;
        }
        return (f(a-1) + f(a-2));
    }
    console.log(f(4));
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 第5章 引用类型(返回首页) 本章内容 使用对象 创建并操作数组 理解基本的JavaScript类型 使用基本类型...
    大学一百阅读 8,889评论 0 4
  • title: Optical Character Recognition (OCR)author: Marina ...
    4a87cc38dcbc阅读 2,895评论 0 0
  • 转至元数据结尾创建: 董潇伟,最新修改于: 十二月 23, 2016 转至元数据起始第一章:isa和Class一....
    40c0490e5268阅读 5,890评论 0 9
  • # tween.js user guide _**NOTE** this is a work in progres...
    3216732c1db1阅读 3,130评论 0 0
  • # javascript 笔记 ## 1 - confign (sudo) - node - npm init -...
    wwzwwz阅读 1,535评论 0 0

友情链接更多精彩内容