0

Javascript

How can i link a javascript file(external) to an html file for them to run together

18th Jul 2024, 11:35 AM
Ola
Ola - avatar
2 ответов
0
Aymen Esam-Aldin is right but in sololearn you cant link new file or your another project, only libs which can be gotten by link if your script required to use addEventListener or another fn that needs to use DOM elements you should put <script> under the body tag for ESMA or NodeJS you shold use export function / export default function OR module.exports = {} / module.exports = function/class then import them like a import { fn } from './file.js' / import fn from './file.js' OR const fn = require('./file.js') / const {fn} = require('./file.js')
25th Jul 2024, 12:08 AM
exez
exez - avatar