V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  leconio  ›  全部回复第 1 页 / 共 16 页
回复总数  305
1  2  3  4  5  6  7  8  9  10 ... 16  
15 小时 30 分钟前
回复了 Bateman 创建的主题 问与答 哪有便宜的黄油和芝士卖?
lsp 们可以出去了,OP 正经问的。
2 天前
回复了 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');
这文笔,不去写本子可惜了
2 天前
回复了 UIXX 创建的主题 问与答 2024 年中买什么平板好
生态上还是 iPad 好。我串流游戏狗选择联想 y700 。
对 HDR 有要求无脑 iPad 吧,安卓调色都怪怪的
2 天前
回复了 ixoy 创建的主题 分享发现 警惕!逛会展被诈骗了
在深圳?有点不敢相信,打 12345 让他们跟进,要求主办方假 1 赔 10 。
5 天前
回复了 sbldehanhan 创建的主题 MacBook Pro 哪款 Macbook 可以跑 UE 引擎?
这两家不是还有官司吗,ue 很多特性都不在 mac 上的吧,学习的话就随便了。
也建议出保就换车。
干式双离合老毛病了,dp200 最好不要碰吧。除非你在乡镇或者地广人稀地方开车。我有个同事,在深圳开 dq200 ,保内换了 3 个离合,出保就换车了。
7 天前
回复了 llxe2v 创建的主题 硬件 铭凡 amd mini 主机外接 nvidia 显卡?
1 年前,minisforum 的 um773 的 USB4 外接显卡好像有点问题,有概率识别不了。不清楚现在变好了没有
7 天前
回复了 david101 创建的主题 汽车 驾照到手,买车大家帮忙推荐
@jacksonj297 你说的是豪华车,不是专车。比亚迪汉级别的
需要分发的话一年 688 ,跑到设备上就注册个账号就行了吧
8 天前
回复了 david101 创建的主题 汽车 驾照到手,买车大家帮忙推荐
考驾照可以满世界自驾游呀,多一种旅行方式多好。如果住城镇肯定是需要买车的,没车等于没腿。城市里面买车可以提高幸福度,如果只考虑成本,20W 可以打好几年的滴滴专车。
8 天前
回复了 impdx 创建的主题 路由器 求推荐硬路由(1000 内)
@belin520 看固件了,AX86U 有一个版本 koolshare 官改固件是断流严重的,我刷的梅林很好,硬件是没问题的。
8 天前
回复了 v2lover 创建的主题 问与答 有没有办法屏蔽联通这种宣传短信?
移动也有,哈哈哈,做好心理准备咯。要干净就买流量卡。
8 天前
回复了 impdx 创建的主题 路由器 求推荐硬路由(1000 内)
@belin520 没发现断流呀
8 天前
回复了 impdx 创建的主题 路由器 求推荐硬路由(1000 内)
华硕 AX86U ,很稳。
8 天前
回复了 tsohgdivil 创建的主题 Apple 好纠结啊 Apple 官方提供的技术栈
supabase?
@lxh1983 这又是哪里的新闻?去年是有一个更新失业率统计规则的通知,但也不是不更新呀。现在每个月都在更新,去国家统计局去查
1  2  3  4  5  6  7  8  9  10 ... 16  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   867 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 89ms · UTC 23:00 · PVG 07:00 · LAX 16:00 · JFK 19:00
Developed with CodeLauncher
♥ Do have faith in what you're doing.