{
name:
sex:
age:
subject:
score:
}
当前有一个数组array里以上面的结构存放了一些数据, 用js实现以下需求
返回每个科目分数都在90以上的所有女同学的数组,并根据语文分数和同学姓名排序
const array = [
{
name: "吕浩龙",
sex: "男",
age: 18,
subject: "语文",
score: 90,
},
{
name: "吕浩龙",
sex: "男",
age: 18,
subject: "数学",
score: 76,
},
{
name: "吕浩龙",
sex: "男",
age: 18,
subject: "英语",
score: 86,
},
{
name: "张明",
sex: "女",
age: 17,
subject: "语文",
score: 78,
},
{
name: "张明",
sex: "女",
age: 17,
subject: "数学",
score: 98,
},
{
name: "张明",
sex: "女",
age: 17,
subject: "英语",
score: 70,
},
{
name: "邱海",
sex: "男",
age: 18,
subject: "语文",
score: 90,
},
{
name: "邱海",
sex: "男",
age: 18,
subject: "数学",
score: 89,
},
{
name: "邱海",
sex: "男",
age: 18,
subject: "英语",
score: 67,
},
{
name: "龙先旺",
sex: "女",
age: 17,
subject: "英语",
score: 96,
},
{
name: "龙先旺",
sex: "女",
age: 17,
subject: "数学",
score: 94,
}, {
name: "龙先旺",
sex: "女",
age: 17,
subject: "语文",
score: 89,
},
{
name: "李子舰",
sex: "女",
age: 18,
subject: "英语",
score: 98,
},
{
name: "李子舰",
sex: "女",
age: 18,
subject: "数学",
score: 96,
}, {
name: "李子舰",
sex: "女",
age: 18,
subject: "语文",
score: 90,
},
{
name: "杜亚晨",
sex: "男",
age: 18,
subject: "英语",
score: 90,
},
{
name: "杜亚晨",
sex: "男",
age: 18,
subject: "语文",
score: 96,
}, {
name: "杜亚晨",
sex: "男",
age: 18,
subject: "数学",
score: 94,
},
{
name: "焦季雅",
sex: "女",
age: 18,
subject: "英语",
score: 96,
}, {
name: "焦季雅",
sex: "女",
age: 18,
subject: "语文",
score: 78,
}, {
name: "焦季雅",
sex: "女",
age: 18,
subject: "数学",
score: 65,
},
{
name: "侯悠馨",
sex: "男",
age: 18,
subject: "英语",
score: 56,
},
{
name: "侯悠馨",
sex: "男",
age: 18,
subject: "数学",
score: 34,
}, {
name: "侯悠馨",
sex: "男",
age: 18,
subject: "语文",
score: 70,
},
{
name: "车语薇",
sex: "男",
age: 16,
subject: "语文",
score: 67,
},
{
name: "车语薇",
sex: "男",
age: 16,
subject: "数学",
score: 54,
}, {
name: "车语薇",
sex: "男",
age: 16,
subject: "英语",
score: 96,
},
{
name: "牧美玲",
sex: "男",
age: 17,
subject: "英语",
score: 90,
},
{
name: "牧美玲",
sex: "男",
age: 17,
subject: "语文",
score: 98,
}, {
name: "牧美玲",
sex: "男",
age: 17,
subject: "数学",
score: 99,
},
{
name: "吕平蝶",
sex: "男",
age: 18,
subject: "语文",
score: 93,
},
{
name: "吕平蝶",
sex: "男",
age: 18,
subject: "数学",
score: 95,
}, {
name: "吕平蝶",
sex: "男",
age: 18,
subject: "英语",
score: 96,
},
{
name: "曾妮娜",
sex: "女",
age: 18,
subject: "英语",
score: 45,
},
{
name: "曾妮娜",
sex: "女",
age: 18,
subject: "数学",
score: 89,
}, {
name: "曾妮娜",
sex: "女",
age: 18,
subject: "语文",
score: 65,
},
{
name: "韩怡月",
sex: "男",
age: 16,
subject: "英语",
score: 97,
},
{
name: "韩怡月",
sex: "男",
age: 16,
subject: "语文",
score: 95,
},
{
name: "韩怡月",
sex: "男",
age: 16,
subject: "数学",
score: 96,
},
{
name: "印溪澈",
sex: "男",
age: 18,
subject: "英语",
score: 94,
},
{
name: "印溪澈",
sex: "男",
age: 18,
subject: "语文",
score: 91,
}, {
name: "印溪澈",
sex: "男",
age: 18,
subject: "数学",
score: 95,
},
{
name: "邹莹莹",
sex: "女",
age: 18,
subject: "英语",
score: 72,
},
{
name: "邹莹莹",
sex: "女",
age: 18,
subject: "语文",
score: 79,
}, {
name: "邹莹莹",
sex: "女",
age: 18,
subject: "数学",
score: 73,
},
{
name: "简春晓",
sex: "男",
age: 18,
subject: "英语",
score: 35,
},
{
name: "简春晓",
sex: "男",
age: 18,
subject: "语文",
score: 87,
}, {
name: "简春晓",
sex: "男",
age: 18,
subject: "数学",
score: 65,
},
{
name: "慕天恩",
sex: "女",
age: 18,
subject: "英语",
score: 98,
},
{
name: "慕天恩",
sex: "女",
age: 18,
subject: "语文",
score: 99,
},
{
name: "慕天恩",
sex: "女",
age: 18,
subject: "数学",
score: 100,
},
{
name: "冉平蝶",
sex: "男",
age: 18,
subject: "英语",
score: 74,
},
{
name: "冉平蝶",
sex: "男",
age: 18,
subject: "数学",
score: 65,
}, {
name: "冉平蝶",
sex: "男",
age: 18,
subject: "语文",
score: 78,
},
{
name: "向海冬",
sex: "男",
age: 16,
subject: "英语",
score: 67,
},
{
name: "向海冬",
sex: "男",
age: 16,
subject: "数学",
score: 86,
}, {
name: "向海冬",
sex: "男",
age: 16,
subject: "语文",
score: 69,
},
{
name: "龙琰琬",
sex: "男",
age: 17,
subject: "英语",
score: 93,
},
{
name: "龙琰琬",
sex: "男",
age: 17,
subject: "数学",
score: 97,
}, {
name: "龙琰琬",
sex: "男",
age: 17,
subject: "语文",
score: 93,
},
{
name: "朱典雅",
sex: "男",
age: 18,
subject: "英语",
score: 90,
},
{
name: "朱典雅",
sex: "男",
age: 18,
subject: "英语",
score: 94,
}, {
name: "朱典雅",
sex: "男",
age: 18,
subject: "数学",
score: 99,
},
{
name: "方双儿",
sex: "女",
age: 18,
subject: "英语",
score: 69,
},
{
name: "方双儿",
sex: "女",
age: 18,
subject: "语文",
score: 63,
}, {
name: "方双儿",
sex: "女",
age: 18,
subject: "数学",
score: 64,
},
{
name: "杨暖姝",
sex: "男",
age: 15,
subject: "英语",
score: 77,
},
{
name: "杨暖姝",
sex: "男",
age: 15,
subject: "语文",
score: 73,
}, {
name: "杨暖姝",
sex: "男",
age: 15,
subject: "数学",
score: 67,
},
{
name: "汤曼文",
sex: "男",
age: 18,
subject: "英语",
score: 93,
},
{
name: "汤曼文",
sex: "男",
age: 18,
subject: "语文",
score: 92,
},
{
name: "汤曼文",
sex: "男",
age: 18,
subject: "数学",
score: 97,
},
{
name: "龙灵萱",
sex: "女",
age: 18,
subject: "英语",
score: 79,
},
{
name: "龙灵萱",
sex: "女",
age: 18,
subject: "语文",
score: 38,
}, {
name: "龙灵萱",
sex: "女",
age: 18,
subject: "数学",
score: 98,
},
{
name: "益曼荷",
sex: "男",
age: 18,
subject: "英语",
score: 67,
},
{
name: "益曼荷",
sex: "男",
age: 18,
subject: "语文",
score: 89,
}, {
name: "益曼荷",
sex: "男",
age: 18,
subject: "数学",
score: 77,
},
{
name: "汤映安",
sex: "女",
age: 18,
subject: "英语",
score: 89,
},
{
name: "汤映安",
sex: "女",
age: 18,
subject: "语文",
score: 90,
},
{
name: "汤映安",
sex: "女",
age: 18,
subject: "数学",
score: 91,
},
{
name: "宰千易",
sex: "男",
age: 18,
subject: "英语",
score: 95,
},
{
name: "宰千易",
sex: "男",
age: 18,
subject: "语文",
score: 98,
}, {
name: "宰千易",
sex: "男",
age: 18,
subject: "数学",
score: 99,
},
{
name: "古莹莹",
sex: "男",
age: 16,
subject: "英语",
score: 96,
},
{
name: "古莹莹",
sex: "男",
age: 16,
subject: "语文",
score: 93,
},
{
name: "古莹莹",
sex: "男",
age: 16,
subject: "数学",
score: 91,
},
{
name: "苏和怡",
sex: "男",
age: 17,
subject: "英语",
score: 93,
},
{
name: "苏和怡",
sex: "男",
age: 17,
subject: "语文",
score: 92,
},
{
name: "苏和怡",
sex: "男",
age: 17,
subject: "数学",
score: 96,
},
{
name: "国书双",
sex: "男",
age: 18,
subject: "英语",
score: 94,
},
{
name: "国书双",
sex: "男",
age: 18,
subject: "语文",
score: 99,
},
{
name: "国书双",
sex: "男",
age: 18,
subject: "数学",
score: 100,
},
{
name: "巴芷珊",
sex: "女",
age: 18,
subject: "英语",
score: 62,
},
{
name: "巴芷珊",
sex: "女",
age: 18,
subject: "语文",
score: 48,
},
{
name: "巴芷珊",
sex: "女",
age: 18,
subject: "数学",
score: 87,
},
{
name: "乌石瑶",
sex: "男",
age: 15,
subject: "英语",
score: 76,
},
{
name: "乌石瑶",
sex: "男",
age: 15,
subject: "语文",
score: 73,
},
{
name: "乌石瑶",
sex: "男",
age: 15,
subject: "数学",
score: 79,
},
{
name: "卢元风",
sex: "男",
age: 18,
subject: "英语",
score: 96,
},
{
name: "卢元风",
sex: "男",
age: 18,
subject: "语文",
score: 95,
}, {
name: "卢元风",
sex: "男",
age: 18,
subject: "数学",
score: 94,
},
{
name: "杜裕梅",
sex: "女",
age: 18,
subject: "英语",
score: 98,
},
{
name: "杜裕梅",
sex: "女",
age: 18,
subject: "语文",
score: 90,
}, {
name: "杜裕梅",
sex: "女",
age: 18,
subject: "数学",
score: 94,
},
{
name: "乔步美",
sex: "男",
age: 18,
subject: "英语",
score: 93,
},
{
name: "乔步美",
sex: "男",
age: 18,
subject: "语文",
score: 91,
},
{
name: "乔步美",
sex: "男",
age: 18,
subject: "数学",
score: 100,
},
{
name: "容亦丝",
sex: "女",
age: 18,
subject: "英语",
score: 68,
},
{
name: "容亦丝",
sex: "女",
age: 18,
subject: "语文",
score: 87,
},
{
name: "容亦丝",
sex: "女",
age: 18,
subject: "数学",
score: 34,
},
{
name: "吴夏璇",
sex: "男",
age: 18,
subject: "英语",
score: 89,
},
{
name: "吴夏璇",
sex: "男",
age: 18,
subject: "语文",
score: 74,
},
{
name: "吴夏璇",
sex: "男",
age: 18,
subject: "数学",
score: 63,
},
{
name: "禄凡双",
sex: "男",
age: 16,
subject: "英语",
score: 87,
},
{
name: "禄凡双",
sex: "男",
age: 16,
subject: "语文",
score: 89,
},
{
name: "禄凡双",
sex: "男",
age: 16,
subject: "数学",
score: 74,
},
{
name: "甘一璇",
sex: "男",
age: 17,
subject: "英语",
score: 90,
},
{
name: "甘一璇",
sex: "男",
age: 17,
subject: "数学",
score: 87,
}, {
name: "甘一璇",
sex: "男",
age: 17,
subject: "语文",
score: 96,
},
{
name: "符杨柳",
sex: "男",
age: 18,
subject: "英语",
score: 90,
},
{
name: "符杨柳",
sex: "男",
age: 18,
subject: "数学",
score: 98,
}, {
name: "符杨柳",
sex: "男",
age: 18,
subject: "语文",
score: 94,
},
{
name: "储书意",
sex: "女",
age: 18,
subject: "英语",
score: 89,
},
{
name: "储书意",
sex: "女",
age: 18,
subject: "语文",
score: 98,
},
{
name: "储书意",
sex: "女",
age: 18,
subject: "数学",
score: 95,
},
{
name: "瞿涵涵",
sex: "男",
age: 15,
subject: "英语",
score: 67,
},
{
name: "瞿涵涵",
sex: "男",
age: 15,
subject: "语文",
score: 98,
},
{
name: "瞿涵涵",
sex: "男",
age: 15,
subject: "数学",
score: 64,
},
{
name: "蒋嫣然",
sex: "男",
age: 18,
subject: "英语",
score: 96,
},
{
name: "蒋嫣然",
sex: "男",
age: 18,
subject: "语文",
score: 93,
},
{
name: "蒋嫣然",
sex: "男",
age: 18,
subject: "数学",
score: 91,
},
{
name: "乔晏如",
sex: "女",
age: 18,
subject: "英语",
score: 78,
},
{
name: "乔晏如",
sex: "女",
age: 18,
subject: "数学",
score: 78,
},
{
name: "乔晏如",
sex: "女",
age: 18,
subject: "语文",
score: 78,
},
{
name: "阴孟夏",
sex: "男",
age: 18,
subject: "英语",
score: 90,
},
{
name: "阴孟夏",
sex: "男",
age: 18,
subject: "语文",
score: 90,
},
{
name: "阴孟夏",
sex: "男",
age: 18,
subject: "数学",
score: 90,
},
{
name: "寿韶仪",
sex: "女",
age: 18,
subject: "英语",
score: 68,
},
{
name: "寿韶仪",
sex: "女",
age: 18,
subject: "语文",
score: 87,
},
{
name: "寿韶仪",
sex: "女",
age: 18,
subject: "数学",
score: 48,
},
{
name: "终凝然",
sex: "男",
age: 18,
subject: "英语",
score: 65,
},
{
name: "终凝然",
sex: "男",
age: 18,
subject: "语文",
score: 74,
},
{
name: "终凝然",
sex: "男",
age: 18,
subject: "数学",
score: 98,
},
{
name: "池香菱",
sex: "男",
age: 16,
subject: "英语",
score: 94,
},
{
name: "池香菱",
sex: "男",
age: 16,
subject: "语文",
score: 92,
},
{
name: "池香菱",
sex: "男",
age: 16,
subject: "数学",
score: 93,
},
];
先解题
结果
但是这个结果其实并不好看。根据这个结果,再结合题意,我认为只需要把过滤出来的这些同学的含语文成绩那个数据列出来就好,所以可以在排序前先筛出来
再切题意
结果
其他解法
如果不先分组,是不是可以先把女生过滤出来,再找出有分数低于 90 分的,去除,然后过滤出语文成绩进行排序呢?
参考阅读