It can be explained like this: an expression usually needs a variable to receive its value.
顾佳凯 <[email protected]> 于2022年9月27日周二 08:44写道:
Yes, it works in Chrome browser. Adding a unary operation in front of a function will force the parser to treat the part after it as an expression.
This Stack Overflow question teaches me.
Why it works in Chrome and not work in a common JS file. It's a question deserving to explore.
When I use a variable to receive the expression value. It works for me.
Interesting question. Thank you for your nice newsletter.❤️❤️❤️❤️❤️
Tyler McGinnis <[email protected]> 于2022年9月27日周二 08:03写道:
Interesting! Try running it in your browser console. That's where I ran it.
On Mon, Sep 26, 2022 at 6:02 PM 顾佳凯 <[email protected]> wrote:
+[newsletter, tagline].forEach((el) => console.log(el))
This solution is not work for me.
When I run `node xxx.js`, I still get an error-"ReferenceError: Cannot access 'tagline' before initialization".
Pls help me. Looking forward to your reply.❤️❤️❤️❤️❤️
Tyler from ui.dev <[email protected]> 于2022年9月27日周二 01:11写道:
| Welcome to #122. Congrats to Janackeh for winning last week’s Airpods Max! This issue we’ll be giving away a Durgod Taurus K320 TKL Mechanical Keyboard. As you probably know by now, we’re big fans of early 2000’s hip hop. The first person to send us the specific early 2000’s hip hop song we’re thinking of wins. Here’s a clue – the artist who sings this song originally went by Kris Kringle. This week, we’ve got HTML Emmy’s, Age of Empires II cheat codes for your JavaScript, and a badly damaged pituitary gland. Let’s unpack. The Main ThingThe Qwiksilver ® Move Qwik and break thingsYou can always tell something is cool-and-edgy when it intentionally misspells its own name – Boyz II Men, Linkin Park, Froot Loops. And now there’s Qwik — an HTML-first framework that just released its first beta, and claims to offer the “fastest possible page load times, regardless of the complexity of your website.” We’re usually a little dubious of the “blazingest” claims, but the team behind Qwik has definitely earned the benefit of the doubt: Miško Hevery (creator of AngularJS), Manu Almeida (co-creator of Gin and Stencil), and Adam Bradley (co-creator of Ionic and Stencil) are basically the Webvengers. Like React, Qwik is component based. But unlike React (and every other current-gen framework), Qwik renders your site’s UI in a totally unique way that doesn’t require hydration at all. (Bobby Boucher from Waterboy is in shambles.) Why not hydrate? Because hydration is pure overhead that duplicates work and slows down your app, especially as you add more JavaScript (and we all know you’ll be adding more JavaScript). So instead, Qwik introduced Resumability — a new rendering paradigm that allows fully interactive sites to load with a tiny amount of JavaScript, then pick up from where the server left off. As your users interact with your site, the relevant parts of it load on-demand. This “precision lazy-loading” is possible because Qwik apps are fully serialized as HTML. So with server-side rendering, the whole app can be shipped to the browser as just HTML, where it will “resume” loading where it left off — without needing to execute any JavaScript. Hypothetically, this could mean that Qwik is a real-life version of an Age of Empires II cheat code: you can add as much JavaScript as you want to your site, and still get a perfect Lighthouse score (you don’t even have to type in “cheese steak jimmy’s” to activate it). Bottom Line: Qwik feels like one of the most promising new JavaScript frameworks yet, because 1) it’s solving the performance problem in a way that works with most developers’ existing skills and preferences, and 2) it’s built by a team that knows how to scale OSS UI frameworks. Stay tuned. Our Friends |
|
| ||
| Close.com is looking for 3 experienced individuals that have a solid understanding of React and want to help design, implement and launch major user-facing features. Close is a 100% globally distributed team of ~55 high-performing, happy people that are dedicated to building a product our customers love. |
This technical deep dive covers everything you need to know about Multi-Factor Auth — including, “What is it?” and, “Ok but seriously, what is it though?”
const newsletter = "Bytes"
const tagline = "Your weekly dose of JavaScript"
[newsletter, tagline].forEach((el) => console.log(el))
const newsletter = "Bytes"
const tagline = "Your weekly dose of JavaScript"
[newsletter, tagline].forEach((el) => console.log(el))
You might be surprised to learn that this code doesn’t execute. If you try, you’ll get an error – Uncaught ReferenceError: tagline is not defined. But clearly it is, right? Wrongo.
This is the very rare scenario where not using semicolons can bite you. Because we have a string followed by no semicolon followed by an opening array bracket, JavaScript interprets our code like this, as if we’re trying to access elements from the string.
"Your weekly dose of JavaScript"[newsletter, tagline].forEach();
This, of course, throws an error because tagline isn’t defined. To fix this, add a + sign before the array.
const newsletter = "Bytes"
const tagline = "Your weekly dose of JavaScript"
+[newsletter, tagline].forEach((el) => console.log(el))
That’s mostly a joke, but it does work…
Instead, just use semicolons.
const newsletter = "Bytes";
const tagline = "Your weekly dose of JavaScript";
[newsletter, tagline].forEach((el) => console.log(el));
Built with ❤️ by uidotdev
50 W Broadway Ste 333 PMB 51647 Salt Lake City, Utah 84101