@jtong 2016-11-17T03:22:05.000000Z 字数 3096 阅读 1037

# 像机器一样思考（三）—— 穷尽就是力量

教学 Graphic-Language

## 穷尽

["学号", "学号", "学号"]

["TWA20160101", "TWA20160102", "TWA20160103"]

function loadAllScore(){    return [{        name: "张三",        id: "TWA20160101",        chinese: "95",        english: "80",        math: "95",        programming: "80"    },    ....    ]}

成绩单姓名|数学|语文|英语|编程|平均分|总分 ========================张三|75|95|80|80|82.5|330李四|85|80|70|90|81.25|325========================全班总分平均数：xxx全班总分中位数：xxx

#1 生成成绩单view model输入：  studentIds: [String]输出：  scoreSheet: {    studentScores:[{        name: String,        chinese: String,        english: String,        math: String,        programming: String,        average: String,        summary: String    }]    summary: {      totalAverage: Number,      totalMidden: Number    }  }#2 打印成绩单输入：  scoreSheet输出：  result: String

studentScores:[{        chinese: String,        english: String,        summary: String    }]

#1 获得学生成绩输入：    studentIds: [String]    studentInfo: [{        id: String,        name: String,        chinese: String,        english: String,        math: String,        programming: String,    }]输出：    studentScores:[{        name: String        chinese: String,        english: String,        math: String,        programming: String,        average: String,        summary: String    }]#2 计算总计输入：    studentScores输出：    summary: {      totalAverage: Number,      totalMidden: Number    }#3 打印成绩单输入：    studentScores    summary输出：    result: String

1. 参数
2. 读取全局变量
3. 调用全局函数后得到的返回值
4. 读取局部作用域变量（比如this）
5. 调用局部函数后得到的返回值
6. hard code的数据

1. 返回值
2. 修改全局变量
3. 调用全局函数时传的参数
4. 修改局部作用域变量（比如this）
5. 调用局部函数时传的参数

## 来去

#1 获得学生成绩输入：    studentIds: [String]    studentInfo: [{        id: String,        name: String,        chinese: String,        english: String,        math: String,        programming: String,    }]: loadAllScore()输出：    studentScores:[{        name: String,        chinese: String,        english: String,        math: String,        programming: String,        average: String,        summary: String    }]#2 计算总计输入：    studentScores输出：    summary: {      totalAverage: Number,      totalMidden: Number    }#3 打印成绩单输入：    studentScores    summary输出：    result: String: console.log()

• 私有
• 公开
• 删除