functionAdd (user1, length) {Let status=true;//Status ValueConsole.log ("Please enter new student name:"); Let name=readline.question (); Let REG1=/[a-za-z]/;//use regular expressions to ensure that student names are entered correctly while(!reg1.test (name)) {Console.log ("Student name must not contain numbers and illegal characters, please re-lose"); Name=readline.question (); } console.log ("Please enter new Student Age:"); let Age= Readline.question ()-0; while(IsNaN (age) | | < 1) {//guaranteed output Correct ageConsole.log ("Please re-lose"); Age= Readline.question ()-0; } console.log ("Please enter new Student gender:"); Let gender=readline.question (); Console.log ("Please enter new Student scores:"); Let score= Readline.question ()-0; while(IsNaN (score) | | Score < 0 | | score > 100) {//guaranteed output Correct resultsConsole.log ("Please re-lose"); Score= Readline.question ()-0; } console.log ("New success!" The student information is as follows: "); Length++; User1.push ({id:length, name, age, gender, score}) Console.log (User1[length -1]);} Add (user1, user1.length);//calling Functions
JavaScript New Student Information