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

251
Views
Reaccionar: se esperaba una asignación o llamada de función

Soy nuevo con reactjs y tengo un pequeño problema. Recibo un error: esperar una asignación o llamada de función. Se refiere a la función Usuario, pero llamo a esa función a continuación cuando estoy creando un nuevo objeto. ¿Cómo puedo arreglar esto?

 import React from 'react'; import '../css/style.css'; export function Form(){ let users = []; function User(name, surname, age, email, password){ this.name = name; this.surname = surname, this.age = age, this.email = email, this.password = password } function formValues(){ let name = document.getElementById("name").value; let surname = document.getElementById("surname").value; let age = document.getElementById("age").value; let email = document.getElementById("email").value; let pwd = document.getElementById("password").value; var newUser = new User(name, surname,age, email, pwd); users.push(newUser); console.log(users); } return( <div id = "form"> <h2>Sign up today, for free!</h2> <input type="text" id = "name" placeholder = "Name" required/> <input type="text" id = "surname" placeholder = "Surname" required/> <input type="number" id = "age" placeholder = "Age" required /> <input type="email" id = "email" placeholder = "Email" required/> <input type="password" id = "password" placeholder = "Password" required/> <button id = "sign-up" onClick={() => formValues()}>Sign Up</button> </div> ) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su función no usa punto y coma para terminar las expresiones.

 function User(name, surname, age, email, password) { this.name = name; this.surname = surname; this.age = age; this.email = email; this.password = password; }
about 4 years ago · Juan Pablo Isaza Report
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!