leconio 最近的时间轴更新
leconio

leconio

V2EX 第 347735 号会员,加入于 2018-09-06 22:40:02 +08:00
今日活跃度排名 11336
求推荐个串流设备,最好安卓的
硬件  •  leconio  •  162 天前  •  最后回复来自 Puteulanus
6
看看 GPT-4 中文理解能力
分享发现  •  leconio  •  2023-03-31 10:45:55 AM  •  最后回复来自 dashsoap97
10
求助帖,做过跨端(iOS 和 Android)开发的看过来
问与答  •  leconio  •  2019-08-19 10:10:27 AM  •  最后回复来自 yurnery
31
给大家个无足轻重的小 Chrome 插件,复制代码可能用到
程序员  •  leconio  •  2018-11-12 15:47:09 PM  •  最后回复来自 glaucus
1
iMac 如何让发射出来的 wifi 走本地代理
问与答  •  leconio  •  2018-11-08 09:24:40 AM  •  最后回复来自 leconio
2
为什么我不用浏览器
 •  leconio  •  2018-10-24 11:04:26 AM  •  最后回复来自 diggerdu
12
leconio 最近回复了
1 天前
回复了 waiaan 创建的主题 JavaScript 这段 if...else 有优雅的写法吗?
const sortStrategies = {
descending: (prop) => (a, b) => b[prop] - a[prop],
ascending: (prop) => (a, b) => a[prop] - b[prop]
};

const sortCommands = {
thisYearIncome: {
descending: () => sortStrategies.descending('thisYearIncome'),
ascending: () => sortStrategies.ascending('thisYearIncome')
},
lastYearIncome: {
descending: () => sortStrategies.descending('lastYearIncome'),
ascending: () => sortStrategies.ascending('lastYearIncome')
},
rate: {
descending: () => sortStrategies.descending('rate'),
ascending: () => sortStrategies.ascending('rate')
}
};

function createSortCommand(order, prop) {
return sortCommands[prop][order]();
}

const data = [
{ thisYearIncome: 5000, lastYearIncome: 4000, rate: 0.25 },
{ thisYearIncome: 8000, lastYearIncome: 6000, rate: 0.33 },
{ thisYearIncome: 3000, lastYearIncome: 2000, rate: 0.5 },
{ thisYearIncome: 6000, lastYearIncome: 5000, rate: 0.2 }
];

function onSortChange(order, prop) {
const sortCommand = createSortCommand(order, prop);
fetchData(sortCommand);
}

function fetchData(sortCommand) {
const sortedData = data.sort(sortCommand);

console.log('Sorted Data:');
sortedData.forEach((item) => {
console.log(`This Year Income: ${item.thisYearIncome}, Last Year Income: ${item.lastYearIncome}, Rate: ${item.rate}`);
});
}

console.log('Sorting by This Year Income (Descending):');
onSortChange('descending', 'thisYearIncome');

console.log('\nSorting by Last Year Income (Ascending):');
onSortChange('ascending', 'lastYearIncome');

console.log('\nSorting by Rate (Descending):');
onSortChange('descending', 'rate');
这文笔,不去写本子可惜了
1 天前
回复了 UIXX 创建的主题 问与答 2024 年中买什么平板好
生态上还是 iPad 好。我串流游戏狗选择联想 y700 。
对 HDR 有要求无脑 iPad 吧,安卓调色都怪怪的
1 天前
回复了 ixoy 创建的主题 分享发现 警惕!逛会展被诈骗了
在深圳?有点不敢相信,打 12345 让他们跟进,要求主办方假 1 赔 10 。
4 天前
回复了 sbldehanhan 创建的主题 MacBook Pro 哪款 Macbook 可以跑 UE 引擎?
这两家不是还有官司吗,ue 很多特性都不在 mac 上的吧,学习的话就随便了。
6 天前
回复了 llxe2v 创建的主题 硬件 铭凡 amd mini 主机外接 nvidia 显卡?
1 年前,minisforum 的 um773 的 USB4 外接显卡好像有点问题,有概率识别不了。不清楚现在变好了没有
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   790 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 21:45 · PVG 05:45 · LAX 14:45 · JFK 17:45
Developed with CodeLauncher
♥ Do have faith in what you're doing.