Two ways to import and export code in JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024
  • Unlike PHP, you don’t have to include entire files when you need code from elsewhere, you can pull in just bits and pieces using default and named imports and exports.
    ℹ️ This video is part of a crash course series, JS Essentials for WP Devs. Get the entire series, the code repository, and more by signing up for the series via email: aurooba.com/js...
    If you found this video helpful, please subscribe and hit the like button!

ความคิดเห็น • 3

  • @abdiwelinoor4270
    @abdiwelinoor4270 5 หลายเดือนก่อน

    Thanks for sharing an informative note

  • @PatrickJohanneson
    @PatrickJohanneson 5 หลายเดือนก่อน

    When I tried to import './strings', my browsers (Firefox and Chrome) both threw an error: "Uncaught SyntaxError: import declarations may only appear at the top level of a module". Any insight into what I'm doing wrong is appreciated.

    • @AuroobaMakes
      @AuroobaMakes  5 หลายเดือนก่อน

      That means you weren't importing correctly but I can get more specific if you share more. Mind sharing a screenshot or a code gist through github for me to look at?