Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

745
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda