嗨,有一种方法可以减少进入,更漂亮的使用? 漂亮的代码:
Android.bp
我想要的代码:
const reduced = inventors.reduce(
total,
(investor) => {
return total + (investor.passed - investor.year);
},
0
);
还有:
const reduced = inventors.reduce((total, investor) => {
return total + (investor.passed - investor.year);
},0
);
对此:
const observerHome = new IntersectionObserver(
function (entries, observerHome) {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
header.classList.add("header--scrolled");
} else if (entry.isIntersecting) {
header.classList.remove("header--scrolled");
}
});
},
{
rootMargin: "-20% 0% 0% 0%",
}
);
我认为它使用了太多的输入内容,虽然代码应更具可读性,但我发现它过于拉伸和滚动太多。另外,我每行的字符数设置为120(我认为通常是80)。