About 394,000 results
Open links in new tab
  1. How to export variables to other javascript file - Stack Overflow

    Apr 9, 2021 · I want to use variables which is in main.js file in other js file and I tried everything ( exporting modules, declaring global variables) but nothing works and I have to do it because …

  2. export - JavaScript | MDN

    Mar 15, 2025 · In order to use the export declaration in a source file, the file must be interpreted by the runtime as a module. In HTML, this is done by adding type="module" to the <script> …

  3. Export and Import - The Modern JavaScript Tutorial

    Jan 18, 2023 · Export and import directives have several syntax variants. In the previous article we saw a simple use, now let’s explore more examples. We can label any declaration as …

  4. JavaScript Modules - W3Schools

    Modules with functions or variables can be stored in any external file. There are two types of exports: Named Exports and Default Exports. Let us create a file named person.js, and fill it …

  5. JavaScript Export

    Modules can export values (variables, functions, classes, etc.,) using the export keyword. The export keyword exports values from a module so that you can use them in other modules. …

  6. ES6 Import and Export - GeeksforGeeks

    Jan 3, 2023 · Export: You can export a variable using the export keyword in front of that variable declaration. You can also export a function and a class by doing the same. // Statements. …

  7. Node Module Exports Explained – With JavaScript Export Function Examples

    Feb 17, 2021 · For Node.js, this process of code sharing – both within individual projects and in external npm dependencies – is facilitated using module.exports or exports. How do we use …

  8. How to Import and Export Functions in JavaScript

    Dec 23, 2024 · In JavaScript, modules are defined using the export keyword to make functions and variables available to other files, and the import keyword to import those functions and …

  9. Understanding JavaScript import and export (ESM syntax)

    Oct 19, 2020 · In JavaScript, you can export modules in three different ways: You can also specify a default export with export default .. Then you can also import these modules as: A default …

  10. javascript - What is the proper way to export a variable so it can ...

    Nov 17, 2020 · I was wondering about the proper way to export javascript and functions so they are accessable by other modules and also in the global scope. For example I have this .js file …

Refresh