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

738
Visualizações
function is declared but its value is never read (javascript)

I am new to JavaScript recently moved from python.
I am coding fine with my coffee , but this code throws an error, saying that : 'function' is declared but its value is never read. What's wrong with my code. I had also inscribed this script in my index.html and in this tag.
=> <button type="submit" id="login" onclick="sendCred()">

import net from 'net';

var socket = new net.Socket();

function sendCred(){

    // sending the credentials to the python server on ("localhost", 8000)

    var net = require('net');
    var host = 'localhost'
    var port = 8000

    var username = this.username.value;
    var password = this.password.value;
    var socket = new net.Socket();

    socket.connect(port, host, ()=> {
        socket.write(username + "." + password);
    });

    socket.on('data', (data) => {
        console.log(`${data}`);
        socket.destroy();
    });

    // authenticating the process;
    if (user === "Gautam"){
        if (passw === "Admin"){
            document.write("Auth SuccessFul")
        }else{
            var textField = document.querySelector("#error");
            var error = "you've entered a wrong password, click "
            redrctHtml = error + "\n<a href=\"#\">here</a>" + " to change password";
            textField.innerHTML = redrctHtml;
        }
    }
};```

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