你的 JavaScript 自我清理即将变得容易得多

According to the grand unified theory of Muppet types, there are two types of JavaScript developer: Chaos Muppets and Order Muppets.

根据Muppet 类型的大统一理论,JavaScript 开发者有两种类型:Chaos Muppets 和 Order Muppets。

Now, my essential nature is that of a Chaos Muppet. I was born under the “cookies in bed” sign (“fish boomerang” rising). Had I any musical talent, I like to think I’d be more Doctor Teeth than Rowlf; a host more Gonzo than Kermit. This is perhaps best exemplified by the fact that I’m talking about The Muppets in an article about proposed JavaScript standards.

现在,我的本质是一种 Chaos Muppet。我出生在“床上吃饼干”的星座下(“鱼回旋镖”上升)。如果我有任何音乐天赋,我想我会比 Rowlf 更像 Doctor Teeth;比 Kermit 更像 Gonzo 许多。这或许最好地体现在我在讨论拟议的 JavaScript 标准文章中谈论The Muppets

When it comes to JavaScript itself, though, I tell you, I’m as buttoned-up as they come — bordering on fussy, even. I use const by default, and reserve let for the relatively rare exception when I know the value bound to a variable will need to change; I will brook none of this “change a binding whenever” nonsense. What is this, jazz? I am meticulous about scope and tidying up — freeing resources, closing connections, and so on — despite the absolutely staggering number of utensils I manage to bork-bork-bork across the kitchen and into the sink during the course of preparing a real-world meal. Something just comes over me when it comes to JavaScript; I get real “you are all weirdos,” all of a sudden.

不过,当谈到 JavaScript 本身时,我告诉您,我是最严谨的——甚至 bordering on 挑剔,甚至。我默认使用 const,并将 let 保留给相对罕见的例外情况,即当我知道绑定到变量的值需要改变时;我绝不容忍这种“随时更改绑定”的胡闹。这是什么,jazz?我对作用域和清理一丝不苟——释放资源、关闭连接等等——尽管我在准备一顿真实世界的饭菜过程中,设法将惊人数量的厨具bork-bork-bork扔过厨房扔进水槽。当谈到 JavaScript 时,总有什么东西笼罩着我;我突然变得真正“你们都是怪人”。

Those uncharacteristic orderly JavaScript proclivities are the reason my heart sings (on-key, and at a volume that is respectful to its neighboring organs) to see the ongoing work on the explicit resource management proposal. This proposal not only gives us a few new ways to put our objects away when we’re done playing with them, but it codifies some of...

开通本站会员,查看完整译文。

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.153.0. UTC+08:00, 2026-02-15 01:52
浙ICP备14020137号-1 $bản đồ khách truy cập$