Best of JavaScript2024

  1. 1
    Article
    Avatar of communityCommunity Picks·2y

    Say no to console.log!

    Explore alternatives to `console.log` such as `console.dir` for hierarchical listings, `console.table` for tabular data, `console.group` for grouping messages, `console.time` & `console.timeEnd` for timing tasks, and `console.clear` to clear the console, making your development process more productive and enjoyable.

  2. 2
    Article
    Avatar of communityCommunity Picks·2y

    Bye Bye, Try-Catch Blocks: Meet JavaScript's Safe Assignment Operator Proposal😉

    The proposed Safe Assignment Operator (`?=`) in JavaScript aims to simplify error handling by reducing the need for traditional try-catch blocks. This operator transforms function results into a tuple, improving code readability and consistency across APIs. It also automatically handles errors, enhancing security. Inspired by constructs in languages like Go, Rust, and Swift, it supports integration with Promises and async functions and offers customizable error handling via `Symbol.result`.

  3. 3
    Article
    Avatar of communityCommunity Picks·2y

    8 Frontend Tools to Become a Better Developer

    Front-end developers can significantly boost their productivity and create high-quality applications by incorporating lesser-known tools into their workflows. Essential tools include Uiverse for UI elements, the Motion plugin for Figma, CSSFX for animations, Frontend Mentor for real-world coding challenges, GSAP for high-performance animations, CodePen for code experimentation, Polypane for multi-device previews, and Can I Use for browser compatibility checks.

  4. 4
    Article
    Avatar of jetbrainsJetBrains·2y

    JavaScript Best Practices 2024

    JavaScript continues to evolve, and staying up-to-date with the latest best practices is crucial for developers. Key practices include aligning with project-defined rules, using 'let' and 'const' instead of 'var' for variable declarations, leveraging classes over function prototypes, and implementing private class fields with '#'. Arrow functions are recommended for better syntax and context binding, while the nullish coalescing (??) and optional chaining (?.) operators improve code readability and reliability. Modern methods like 'Object.entries()', async/await syntax, and the 'Intl' API are also important for efficient and maintainable code. Additionally, using tools for precise calculations, handling JSON with big integers carefully, and employing robust testing practices are essential for developing high-quality JavaScript projects.

  5. 5
    Article
    Avatar of communityCommunity Picks·2y

    15 amazing things you can do with simple JavaScript 🤯

    Discover the versatile and surprising capabilities of vanilla JavaScript through practical examples. Learn how to find operating system details, prevent page refreshing, redirect users to new pages, validate emails, get the current URL, and detect mobile browsers. Additional features include handling disabled JavaScript, accessing module metadata, getting timezone offsets, setting the cursor to wait, and manipulating console messages with CSS.

  6. 6
    Article
    Avatar of communityCommunity Picks·2y

    100 FREE Frontend Challenges

    The post offers a set of 100 free frontend challenges aimed at improving web development skills, focusing on HTML & CSS, with opportunities to incorporate JavaScript and other frameworks. Each challenge involves recreating a design to build a working website or web app. The goal is to foster a project-based learning approach, encouraging developers to complete all challenges and enhance their chances of landing a web development job.

  7. 7
    Article
    Avatar of devtoDEV·2y

    React Mindset: How New React Developers Should Think

    React, a prominent JavaScript library for building user interfaces, enhances front-end development through reusable components and efficient UI management. New developers should adopt key principles such as thinking in components, embracing declarative programming, understanding state and props, prioritizing composition over inheritance, managing unidirectional data flow, mastering JSX, using hooks, and testing/debugging early to create modular, scalable, and maintainable applications.

  8. 8
    Article
    Avatar of communityCommunity Picks·2y

    JavaScript Visualized

    This post explores the inner workings of promises in JavaScript, including the creation of promises using the `new Promise` constructor, the purpose of the Promise Reaction record, and how promises can be used to handle asynchronous tasks in a non-blocking way.

  9. 9
    Article
    Avatar of devtoDEV·2y

    New CSS media queries syntax 💥

    The new CSS media query syntax simplifies defining responsive breakpoints, making code cleaner and more intuitive. It offers enhanced clarity, efficiency, and compatibility across modern browsers, streamlining the development process.

  10. 10
    Article
    Avatar of communityCommunity Picks·2y

    30+ app ideas with complete source code

    Discover over 30 exciting project ideas with complete source code to help developers generate revenue or build their reputation. Learn to integrate AI features into React apps using CopilotKit, build backends with Appwrite, and use various other tools like Resend, Shadcn UI, Buildship, Taipy, XYflow, Pieces, and Typesense. Each project description includes a popular app built with that tool, showcasing its practical application.

  11. 11
    Article
    Avatar of devtoDEV·2y

    onClick={someFunction} VS onClick={()=>someFunction}

    Using `onClick={someFunction}` directly references the function and executes it on click without creating an extra function, making it more efficient for simple handlers. In contrast, `onClick={() => someFunction()}` creates a new function on each render, ideal for scenarios where arguments need to be passed or additional operations are required before executing the function.

  12. 12
    Article
    Avatar of freecodecampfreeCodeCamp·2y

    Create a Developer Portfolio as a 2D Game

    Learn how to create a unique developer portfolio using Kaboom.js, a JavaScript library for game development. The course covers setup, loading assets, creating game maps, displaying the map, creating the player, programming game boundaries and dialogue, player movement and spawning, camera scaling, animations, and dialogue text.

  13. 13
    Article
    Avatar of communityCommunity Picks·2y

    8 Exciting New JavaScript Concepts You Need to Know

    Explore 8 new and exciting JavaScript concepts including Optional Chaining, Nullish Coalescing, BigInt, globalThis, matchAll(), Promise.allSettled(), String.prototype.at(), and Error Cause. These features help in writing modern, efficient, and scalable code. Examples are provided for each concept to demonstrate their usage.

  14. 14
    Article
    Avatar of medium_jsMedium·2y

    Variable Naming Best Practices in JavaScript

    Effective variable naming in JavaScript involves using 'let' and 'const' instead of 'var', choosing clear and descriptive names, adopting camel case convention, using uppercase for constants, avoiding single-letter names, using plurals for arrays, and prefixing boolean variables. Establishing and adhering to a naming convention improves code readability and maintainability.

  15. 15
    Article
    Avatar of communityCommunity Picks·2y

    Frontend Libraries for Your Next Project

    Choosing the right tools in web development can drastically enhance productivity and user experience. Key frontend libraries to consider include AOS for scroll animations, Chart.js for data visualization, Luxon for date and time manipulation, SweetAlert2 for customizable alerts and modals, SortableJS for drag-and-drop sorting, Floating UI for dynamic tooltips and pop-overs, and FullCalendar for comprehensive calendar functionalities.

  16. 16
    Article
    Avatar of devtoDEV·2y

    🖥️ Windows 11 Clone with React.js

    A developer created a Windows 11 clone web app using React.js, mimicking various Windows 11 functions like an interactive desktop environment, taskbar with start menu, and applications such as Chrome, Calculator, and VS Code. Other features include a responsive frontend and a simulated login screen. The technical stack includes React.js, Tailwind CSS, React Router DOM, Framer Motion, and React Draggable. The source code and demo are available on GitHub.

  17. 17
    Article
    Avatar of communityCommunity Picks·2y

    JavaScript (JS) Cheat Sheet Online

    Interactive JavaScript Cheat Sheet with code examples covering basics, loops, conditionals, variables, data types, strings, events, numbers, dates, arrays, global functions, regular expressions, errors, JSON, and promises.

  18. 18
    Article
    Avatar of freecodecampfreeCodeCamp·2y

    React Best Practices Ever Developer Should Know

    This guide offers crucial tips on optimizing React development using hooks. It covers the importance of maintaining immutability in state management, avoiding the overuse of useState, leveraging useMemo for performance improvements, ensuring unique keys for list items, and properly handling dependencies in useEffect. The guide also advises on alternatives to useEffect for managing side effects efficiently, contributing to cleaner and more efficient code.

  19. 19
    Article
    Avatar of communityCommunity Picks·2y

    React Design Patterns

    React design patterns are essential for frontend development as they offer solutions to recurring challenges in component design. They promote consistency, modularity, and scalability by simplifying state management, logic, and element composition. Examples include custom hooks, higher-order components, and prop-based rendering techniques. These patterns not only solve technical problems but also enhance code efficiency, readability, and maintainability. This guide provides insights into various patterns like Custom Hook, HOC, Extensible Styles, Compound Components, Render Props, Control Props, Props Getters, State Initializer, and State Reducer, along with their benefits and implementation examples.

  20. 20
    Article
    Avatar of hnHacker News·1y

    Draw.Audio

    The post discusses the Draw.Audio tool which requires browser support for the Web Audio API to function. It introduces basic controls for manipulating sound, including scaling and transposing notes, with options to select the root note and generate sounds.

  21. 21
    Article
    Avatar of devtoDEV·1y

    100+ Frontend Projects to level up your Skills

    Finding interesting frontend projects to work on can be challenging for both beginners and experienced developers. This post shares a GitHub repository with over 100 frontend projects, complete with source code. The projects range from beginner to advanced levels, covering a variety of applications like calculators, e-commerce websites, and more. Tips on how to select, analyze, and customize these projects are also provided to help developers improve their skills and build an impressive portfolio.

  22. 22
    Article
    Avatar of communityCommunity Picks·2y

    CORS: the ultimate guide

    CORS (Cross-Origin Resource Sharing) is a security mechanism that protects users' data from being accessed by malicious websites when different origins interact. AJAX (Asynchronous JavaScript And XML) requests from web browsers are controlled by CORS rules, ensuring data confidentiality and security. This guide explains how CORS policies are configured via HTTP response headers to allow or deny access based on origin and credentials. It also highlights the dangers of misconfigured CORS policies and provides steps to define a secure CORS policy effectively.

  23. 23
    Article
    Avatar of communityCommunity Picks·2y

    Why the with() method of JavaScript Array is a gem?

    The with() method in JavaScript arrays, introduced in ECMAScript 2023, allows developers to change a value at a specified index immutably, meaning the original array remains unchanged. It also supports negative indexing, which is not possible with direct indexing. The method is useful for maintaining the integrity of original data structures and enabling method chaining with other array methods like map() and filter().

  24. 24
    Article
    Avatar of communityCommunity Picks·2y

    Frontend resources! 🚀

    A collection of frontend resources for UI creation, performance optimization, and more.

  25. 25
    Article
    Avatar of communityCommunity Picks·2y

    JavaScript Interview: Can You Stop or Break a forEach Loop? 🛑

    Exploring the limitations of the forEach method in JavaScript and alternative solutions for breaking out of loops.