Logo
    Search

    Podcast Summary

    • Exploring 'nothing' values in programming and using Prismic and LogRocketLearn about handling null, undefined, void, false, 0, and empty arrays/objects as 'nothing' values in programming. Discover Prismic's slices feature for creating dynamic content zones and using LogRocket for debugging apps with visual, scrubbable video replays.

      Learning from this episode of Syntax is that the discussion revolved around the concept of "nothing" in programming, specifically null, undefined, void, false, 0, and empty arrays or objects. These values represent the absence of a value or something that does not exist. The hosts, Scott Tolinski and Wes Bos, also shared their experiences with using Prismic and LogRocket in their development projects. Prismic, a headless CMS, was discussed in detail, particularly their new feature called slices. Slices allow for dynamic content zones, enabling content writers to compose richer page layouts by adding non-repeatable and repeatable pieces of content in any order. This makes it easier to create complex pages with various components, such as call-to-action buttons, videos, and galleries. LogRocket, another sponsor, was introduced as a tool for developers to see all bugs in their applications in a visual, scrubbable video replay. It provides access to network logs, error logs, Redux stores, and connects with various services. LogRocket can be used both on-premise and in the cloud, with a comprehensive list of supported services available on their website. Overall, the episode provided valuable insights into handling "nothing" values in programming and introduced useful tools like Prismic and LogRocket for developers.

    • Understanding the differences between undefined, null, and void in JavaScriptJavaScript has three distinct concepts representing 'nothing': undefined (implicit), null (explicit), and void (function return). Understanding their nuances can lead to effective and efficient code.

      JavaScript has two distinct concepts representing "nothing": undefined and null. While both can be considered as values representing the absence of a value, they have different meanings. Undefined signifies a variable that has been created but not yet assigned a value. It's an implicit representation of nothing. For instance, if you declare a variable 'Scott' without assigning it a value, its initial state is undefined. Similarly, a function that doesn't return anything will implicitly return undefined. On the other hand, null is an explicit representation of nothing. It is a value that signifies the intentional absence of any object value. The difference between null and undefined can be confusing, but understanding their nuances is crucial. When you want to set a variable to nothing, you can use either undefined or null. However, if you're trying to unset a variable (bring it back to its original state of not being set), use undefined. Another concept related to nothing in JavaScript is void. It is used to denote a function that returns nothing. Void is often used in type definitions and can be observed in libraries like React 3 Fiber and React Spring. In summary, understanding the differences between undefined, null, and void can help you write more effective and efficient JavaScript code. By grasping their unique meanings, you'll be able to make informed decisions when deciding which concept to use in your projects.

    • Understanding the Role of 'void' and 'never' in JavaScript and TypeScript'void' and 'never' are keywords in JavaScript and TypeScript used to handle functions and their return values. 'void' can be used to ignore returned values, ensuring proper function behavior in certain scenarios. 'never' represents a value that will never be returned from a function. These keywords improve code readability, maintainability, and type safety.

      The "void" keyword in JavaScript and TypeScript serves an important role in handling functions and their return values. It can be used to ignore the returned values of a function, allowing for more flexibility in certain programming scenarios. For instance, in JavaScript, you can mark a function that doesn't return anything as "void" before calling it, ensuring it always returns undefined. In TypeScript, the "never" type can be used to represent a value that will never be returned from a function. This is particularly useful when creating functions that throw errors or never end, ensuring type safety in your code. One interesting use case for "void" is in React components when using state functions that don't return anything. By marking these functions as "void," you can prevent potential issues with useEffect and its cleanup function, as useEffect requires a return value to function properly. Additionally, "void" can be used to prevent the default behavior of an event, such as a form submission, making it an alternative to using "event.preventDefault()." However, it's important to note that using "void" improperly, such as on a link or a button, can lead to accessibility issues and should be avoided. Instead, use "button" elements for such functionality. Overall, understanding the use of "void" and "never" in JavaScript and TypeScript can help improve code readability, maintainability, and overall type safety.

    • Understanding Function Returns and Falsy Values in JavaScriptFunctions that throw errors or enter infinite loops are denoted as 'never' in types. Falsy values include not only false but also 0, negative 0, empty string, and undefined. 0 and negative 0 are distinct values, and understanding falsy values can save time and mental energy.

      In programming, particularly in JavaScript, there are certain concepts related to functions and their returns. Some functions do not return any value, and this is different from a function that returns undefined. The former is denoted as "never" in types. Functions can become "never" when they throw errors or enter infinite loops. Another concept discussed was falsy values, which include not only false but also other values like 0, negative 0, and the empty string, that evaluate to false in a conditional context. Understanding these concepts can help improve code clarity and avoid potential errors. For instance, 0 and negative 0 are two distinct values, and understanding the difference can save time and mental energy. Additionally, the falsy value "false" itself was mentioned, as well as the use of big integers (0n) for handling large numbers. Overall, this discussion provided valuable insights into the intricacies of function returns and falsy values in JavaScript.

    • Checking for emptiness in arrays and objectsAn empty string is falsy, an empty array has a length of 0 and is falsy, an empty object exists but has no properties and is truthy. Use length for arrays and object.keys() for objects to check for emptiness.

      While an empty string, an empty array, and an empty object are different types of values, they behave differently when it comes to truthiness and falsiness in JavaScript. An empty string is a falsy value, an empty array is a collection with a length of 0, which is a falsy value, and an empty object is a truthy value that exists but has no properties. To check if an array or an object is empty, use the length property for arrays and object.keys() method for objects. The length property for arrays returns a falsy value if the array is empty, and object.keys() returns an empty array if the object has no properties. Additionally, it's important to note that unlike for...in loops, using object.keys() does not return prototype properties, making it a reliable way to check for empty objects without worrying about prototype pollution. Understanding the difference between falsy and truthy values and how to check for emptiness in arrays and objects is crucial for writing clean and efficient code in JavaScript.

    Recent Episodes from Syntax - Tasty Web Development Treats

    792: Perfect Sitemaps for SEO

    792: Perfect Sitemaps for SEO

    Scott and Wes break down the importance of sitemaps for SEO. They dive into the different file formats, essential fields, and common pitfalls to avoid when creating and submitting your sitemap to search engines.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    791: LLRT The Serverless Runtime w/ Richard Davison

    791: LLRT The Serverless Runtime w/ Richard Davison

    Scott and Wes chat with Richard Davison from AWS about LLRT, a new runtime tailored specifically for Lambda. They dive into the benefits of using LLRT, challenges with JavaScript in serverless, and why Rust was chosen for its development.

    Show Notes

    Sick Picks

    Shameless Plugs

    • Richard: Javascript

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    790: State of JS 2023 Reactions

    790: State of JS 2023 Reactions

    Scott and Wes dive into the 2023 State of JavaScript survey, breaking down the latest trends and pain points in front-end frameworks, build tools, and JavaScript runtimes. Tune in for their hot takes and insights on what’s shaping the JavaScript landscape this year!

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    789: Do More With AI - LLMs With Big Token Counts

    789: Do More With AI - LLMs With Big Token Counts

    Join Scott and CJ as they dive into the fascinating world of AI, exploring topics from LLM token sizes and context windows to understanding input length. They discuss practical use cases and share insights on how web developers can leverage larger token counts to maximize the potential of AI and LLMs.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    CJ: X Instagram YouTube TwitchTV

    Randy: X Instagram YouTube Threads

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    Scott and CJ chat with Paul Copplestone, CEO and co-founder of Supabase, about the journey of building an open source alternative to Firebase. Learn about the tech stack, the story behind their excellent documentation, and how Supabase balances business goals with open-source values.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 Who is Paul Copplestone?
    • 01:17 Why ‘Supa’ and not ‘Super’?
    • 02:26 How did Supabase start?
    • 08:42 Simplicity in design.
    • 10:32 How do you take Supabase one step beyond the competition?
    • 12:35 How do you decide which libraries are officially supported vs community maintained?
      • 15:17 You don’t need a client library!
    • 16:48 Edge functions for server-side functionality.
    • 18:51 The genesis of pgvector.
    • 20:59 The product strategy.
    • 22:25 What’s the story behind Supabase’s awesome docs?
    • 25:26 The tech behind Supabase.
    • 35:46 How do you balance business goals with open source?
    • 42:01 What’s next for Supabase?
    • 44:15 Supabase’s GA + new features.
    • 48:24 Who runs the X account?
    • 50:39 Sick Picks + Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    CJ: X Instagram YouTube TwitchTV

    Randy: X Instagram YouTube Threads

    787: You Should Try Vue.js

    787: You Should Try Vue.js

    Scott and CJ dive deep into the world of Vue.js, exploring what makes this frontend framework unique and why it stands out from React and Svelte. CJ gives a comprehensive tour, covering everything from getting started to advanced features like state management and Vue’s built-in styles.

    Show Notes

    Vue.js: The Documentary.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    786: What Open Source license should you use?

    786: What Open Source license should you use?

    Scott and CJ dive into the world of open source, breaking down its meaning, benefits, and the various types of licenses you’ll encounter. From permissive licenses like MIT and Apache 2.0 to copy-left licenses such as GNU GPLv3, they’ll help you choose and apply the right license for your project.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    785: What’s Next for NextJS with Tim Neutkens

    785: What’s Next for NextJS with Tim Neutkens

    Scott and Wes dive into the world of Next.js with special guest Tim Neutkens from Vercel. They explore the latest updates, including the React Compiler and React Server Components, discussing their impact on developer workflows and the future of Next.js development.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 What does the React Compiler do?
    • 05:04 Will React Compiler help with managing Context?
    • 06:39 What happens if you’re not using a React Compiler?
    • 09:30 Will this work on any NextJS version?
    • 12:18 What are React Server Components?
    • 16:28 Shipping all the data inside an encapsulated component.
    • 20:17 Clearing up the frustrations around retrofitting server components.
    • 23:13 Handing migration.
    • 28:30 Is this just a fetch request with props?
    • 36:41 How closely are the NextJS and React teams working?
    • 41:53 Will we ever get Async Client Components?
    • 43:52 Async Local Storage API.
    • 45:31 Turbopack.
    • 57:51 Sick Picks & Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    784: Logging × Blogging × Testing × Freelancing

    784: Logging × Blogging × Testing × Freelancing

    In this Potluck episode, Scott and Wes tackle listener questions on modern blogging, website environmental impact, and using LangChain with LLMs. They also cover CSS hyphens, unit vs. integration testing, and balancing web development with new parenthood.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    Scott and Wes dive into the world of browser caching for audio files, exploring the File System API and the Cache API. They discuss size restrictions across different browsers, how tools like Riverside.fm leverage IndexedDB, and walk through code examples for creating, retrieving, and managing cached audio data.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    Related Episodes

    This vs That × map vs reduce, forEach vs for in, and more!

    This vs That × map vs reduce, forEach vs for in, and more!

    In this Hasty Treat, Scott and Wes do a little this vs that with map vs reduce, forEach vs for in, .hasOwnProperty() vs in vs .hasOwn(), CSS absolute + left/right/top/bottom vs transform, and more.

    Prismic - Sponsor

    Prismic is a Headless CMS that makes it easy to build website pages as a set of components. Break pages into sections of components using React, Vue, or whatever you like. Make corresponding Slices in Prismic. Start building pages dynamically in minutes. Get started at prismic.io/syntax.

    Sentry - Sponsor

    If you want to know what’s happening with your code, track errors and monitor performance with Sentry. Sentry’s Application Monitoring platform helps developers see performance issues, fix errors faster, and optimize their code health. Cut your time on error resolution from hours to minutes. It works with any language and integrates with dozens of other services. Syntax listeners new to Sentry can get two months for free by visiting Sentry.io and using the coupon code TASTYTREAT during sign up.

    Show Notes

    • 01:30 Sponsor: Prismic
    • 02:58 Sponsor: Sentry
    • 04:21 .filter() and .map() (every, one, etc…) VS Reduce
    • 09:17 .forEach() vs for in / for of
    • 15:52 .hasOwnProperty() vs in vs .hasOwn()
    • 19:37 CSS absolute + left/right/top/bottom vs transform
    • 22:54 Object.assign({}, obj) vs {…spread}
    • Animal Friendly idioms

    Tweet us your tasty treats

    Hasty Treat - CSRF Explained

    Hasty Treat - CSRF Explained

    In this Hasty Treat, Scott and Wes talk about CSRF (Cross Site Request Forgery)!

    Prismic - Sponsor

    Prismic is a Headless CMS that makes it easy to build website pages as a set of components. Break pages into sections of components using React, Vue, or whatever you like. Make corresponding Slices in Prismic. Start building pages dynamically in minutes. Get started at prismic.io/syntax.

    Sentry - Sponsor

    If you want to know what’s happening with your code, track errors and monitor performance with Sentry. Sentry’s Application Monitoring platform helps developers see performance issues, fix errors faster, and optimize their code health. Cut your time on error resolution from hours to minutes. It works with any language and integrates with dozens of other services. Syntax listeners new to Sentry can get two months for free by visiting Sentry.io and using the coupon code TASTYTREAT during sign up.

    Show Notes

    05:40 - What is it?

    07:50 - Solutions

    • SameSite Cookie
    • https://medium.com/swlh/secure-httponly-samesite-http-cookies-attributes-and-set-cookie-explained-fc3c753dfeb6
      • Lax — Default value in modern browsers. Cookies are allowed to be sent with top-level navigations and will be sent along with GET requests initiated by a third party website. The cookie is withheld on cross-site subrequests, such as calls to load images or frames, but is sent when a user navigates to the URL from an external site, such as by following a link.
      • Strict — As the name suggests, this is the option in which the Same-Site rule is applied strictly. Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. The browser sends the cookie only for same-site requests (that is, requests originating from the same site that set the cookie). If the request originated from a different URL than the current one, no cookies with the SameSite=Strict attribute are sent.
      • None — Cookies will be sent in all contexts, i.e sending cross-origin is allowed. The browser sends the cookie with both cross-site and same-site requests.
    • CSRF Token
    • Check Origin / Referrer Headers
    • Captcha
    • Ask for Password
    • Token

    Tweet us your tasty treats!