Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

72
Visualizações
Javascript DOM methods are not working after Import Class User.js

User.js

export default class User
{
    constructor()
    {
        this.Name;
        this.Email;
    }
}

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<body>
    <div>
        <p>Index Page</p>
        <button onclick="AlertFunction()">Click</button>
    </div>
</body>
<script type="text/javascript" src="index.js"></script>
</html>

index.js

import User from './Modules/User.js';

let thisUser = new User();
thisUser.Name = 'Javascript';
console.log(thisUser.Name);

function AlertFunction()
{
    alert('Alert Clicked');
}

Actual problem: AlertFunction() is not working after the import statement. I want to use class User Type in multiple .js files.

I want to write Util class in Javascript and use it for various files inside my project. I am new to Javascript. Before now I was a .net developer.

In .net we can access all .cs (cSharp files) in the environment. We can access it as a new type for the entire project. We don't need import statements.

But, here in the javascript please help me to understand how import works.

  • How to create a class and use it as a new Type for the entire project. [Pure Javascript]
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda