Soy nuevo en JavaScript recientemente movido de python.
Estoy codificando bien con mi café, pero este código arroja un error que dice: 'función' se declara pero su valor nunca se lee . ¿Qué le pasa a mi código ? También inscribí este script en mi index.html y en esta etiqueta.
=> <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; } } };```