Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

736
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!