About 1,450,000 results
Open links in new tab
  1. Import functions from another js file. Javascript - Stack Overflow

    Jan 12, 2018 · How to import a JavaScript function from a JavaScript file in the same directory?

  2. How do I include a JavaScript file in another JavaScript file?

    Jun 4, 2009 · It includes a main.js file in the main HTML and then the script in main.js uses $.import_js() to import an additional file called included.js, which defines this function: function …

  3. In Node.js, how do I "include" functions from my other files?

    function include(file_) { with (global) { eval(fs.readFileSync(file_) + ''); }; }; include('somefile_with_some_declarations.js'); // the declarations are now accessible here. …

  4. import - JavaScript | MDN - MDN Web Docs

    Apr 3, 2025 · To load modules in non-module contexts, use the dynamic import syntax instead. All imported bindings cannot be in the same scope as any other declaration, including let, const, …

  5. JavaScript Modules - W3Schools

    JavaScript modules allow you to break up your code into separate files. This makes it easier to maintain a code-base. Modules are imported from external files with the import statement. …

  6. How to Import Function From Another JS File - Delft Stack

    Feb 15, 2024 · This tutorial demonstrates how we can call a JavaScript function from one JS file into another JS file on local machine. It also exemplifies the use of ES6 import and export …

  7. How To Include a JavaScript File in Another JavaScript File?

    Oct 28, 2024 · The import and export syntax available in ES6 (ECMAScript 2015) module is used to include a JavaScript file in another JavaScript file. This approach is the most modern and …

  8. JavaScript Import Function From Another File - SoftAuthor

    Jun 16, 2023 · In this JavaScript tutorial, you’re going to learn how to import a function from another JavaScript file with 3 simple steps. Convert JavaScript File to an ES Module; Declare …

  9. Import and export Classes and Functions in JavaScript

    Mar 6, 2024 · To import a function from another file in JavaScript: Export the function from file A , e.g. export function sum() {} . Import the function in file B as import {sum} from './another-file.js' .

  10. Calling a JavaScript function in another js file - Stack Overflow

    use "var" while creating a function, then you can access that from another file. make sure both files are well connected to your project and can access each other. file_1.js var …

Refresh